kis*_*u27 52 android android-theme
我正在Holo Theme上创建一个对话框,并希望按照操作系统默认的方式显示按钮.到目前为止,我已经创建了对话框,但按钮不像在Holo for ICS中完成的应用程序那样呈现.我怎样才能做到这一点?我想要的外观和感觉是
我能够到达这里

Sim*_*ays 85
有点晚了,但也许有人仍对此感兴趣.
这对我来说非常有用.
...
<!--
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>
...
Run Code Online (Sandbox Code Playgroud)
加载此布局的活动需要Holo.Dialog主题.
android:theme="@android:style/Theme.Holo.Dialog"
Run Code Online (Sandbox Code Playgroud)
kis*_*u27 22
这是有效的:
<LinearLayout
android:id="@+id/buttonHolder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/cmdSignup"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/Signup" />
<Button
android:id="@+id/cmdLogin"
style="@android:style/Widget.Holo.Light.Button.Borderless.Small"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/Login" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
该酒店style="@android:style/Widget.Holo.Light.Button.Borderless.Small"给出了扁平的外观和感觉,以及50%的重量分布是因为相结合的$ 100大小的LinearLayout由android:layout_width="match_parent" and机器人:layout_weight ="1"为`按钮
| 归档时间: |
|
| 查看次数: |
54596 次 |
| 最近记录: |