Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Android列表首选项中设置自定义主题_Android_Themes_Preference - Fatal编程技术网

在Android列表首选项中设置自定义主题

在Android列表首选项中设置自定义主题,android,themes,preference,Android,Themes,Preference,在我的Android应用程序中,我在不同的活动中使用不同的自定义主题,所有这些都很好。所有这些主题对按钮、编辑控件等使用相同的自定义样式 我的首选项使用标准的首选项活动,我通过清单以XML和样式定义这些活动 但是,当我有一个导致警报对话框启动的首选项时,例如ListPreference,该对话框使用标准按钮。它似乎在EditTextPreference中使用了我的自定义EditText样式。。。但不是我的背景或文字颜色 有人知道为什么会这样吗 部分代码: 风格: <style name="

在我的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>

@可绘制/背景
@样式/自定义按钮样式
@样式/自定义编辑文本样式
@可绘图/自定义按钮
@尺寸/对话框\文本\大小\正常
@颜色/对话框\u控件\u颜色
@可绘制/自定义文本字段
@颜色/对话框\u控件\u颜色
@尺寸/对话框\文本\大小\正常
在舱单上:

<activity
    android:name="com.breadbun.prefs.MainPreferencesActivity"
    android:theme="@style/Theme.Prefs"
    android:screenOrientation="portrait">
</activity>

要自定义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>

@风格/对话风格