I'm creating a Dialog Box on Holo Theme and want to follow the OS default way of displaying the buttons. So far I have created the dialog box but the buttons don't render in the way it does in the apps done in Holo for ICS.
How can I do this?
My intended look & feel is
and I am able to reach till here
有点晚了,但也许有人对此仍然感兴趣。
这对我来说效果很好。
...
<!--
EDIT: be carefull, "?android:attr/dividerHorizontal" is only supported since API 11
just avoid it in prior OSs.
-->
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="?android:attr/dividerHorizontal" />
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="0dip"
android:paddingLeft="2dip"
android:paddingRight="2dip"
android:measureWithLargestChild="true">
<Button
android:id="@+id/cancel"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@android:string/cancel"/>
<Button
android:id="@+id/ok"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@android:string/ok"/>
</LinearLayout>
...
加载此布局的活动需要 Holo.Dialog 主题。
android:theme="@android:style/Theme.Holo.Dialog"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)