Ori*_*Bri 5 android themes preference
在我的Android应用程序中,我在不同的活动中使用各种自定义主题,所有这些都可以正常工作.所有这些主题都使用相同的自定义样式按钮,编辑控件等.
我的首选项使用标准的首选项活动,我通过清单以XML和样式定义.
但是,当我有一个首选项导致启动警报对话框时,例如ListPreference,该对话框使用标准按钮.它似乎在EditTextPreference中使用我的自定义EditText样式 ...但不是我的背景或文本颜色.
任何人都知道为什么会这样吗?
一些代码:
样式:
<style name="Theme.Prefs" parent="@android:style/Theme.Holo.Light">
<item name="android:windowBackground">@drawable/background</item>
<item name="android:buttonStyle">@style/CustomButtonStyle</item>
<item name="android:editTextStyle">@style/CustomEditTextStyle</item>
</style>
<style name="CustomButtonStyle" parent="@android:style/Widget.Holo.Button">
<item name="android:background">@drawable/custom_button</item>
<item name="android:textSize">@dimen/dialog_text_size_normal</item>
<item name="android:textColor">@color/dialog_control_colour</item>
</style>
<style name="CustomEditTextStyle" parent="@android:style/Widget.Holo.EditText">
<item name="android:background">@drawable/custom_textfield</item>
<item name="android:textColor">@color/dialog_control_colour</item>
<item name="android:textSize">@dimen/dialog_text_size_normal</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在清单中:
<activity
android:name="com.breadbun.prefs.MainPreferencesActivity"
android:theme="@style/Theme.Prefs"
android:screenOrientation="portrait">
</activity>
Run Code Online (Sandbox Code Playgroud)
小智 1
要自定义alertDialog,您需要将第二行添加到主主题中,然后按照您想要的方式自定义DialogStyle。
<style name="AppTheme" parent="android:Theme.Material">
<item name="android:alertDialogTheme">@style/DialogStyle</item>
</style>
<style name="DialogStyle" parent="android:Theme.Material.Dialog.Alert">
</style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1687 次 |
| 最近记录: |