Android设置自定义首选项分隔符颜色
我正在制作一个应用程序,使用设置菜单的首选项。我有菜单中不同对象的代码,但是分隔符是淡白色的。我想把它做成更深的颜色(像黑色),这样更容易看到。我目前的代码如下: preferences.xml:Android设置自定义首选项分隔符颜色,android,android-preferences,Android,Android Preferences,我正在制作一个应用程序,使用设置菜单的首选项。我有菜单中不同对象的代码,但是分隔符是淡白色的。我想把它做成更深的颜色(像黑色),这样更容易看到。我目前的代码如下: preferences.xml: <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceCategory android:title="Appearance" />
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Appearance" />
<ListPreference
android:key="color_scheme"
android:title="Color Scheme"
android:summary="Change the color scheme of the app"
android:dialogTitle="Color Scheme"
android:entries="@array/colors"
android:entryValues="@array/colors"
android:defaultValue="Default (Blue Gray)" />
<PreferenceCategory
android:title="Other" />
<Preference
android:key="@string/preference_reset"
android:title="Reset Values"
android:summary="Reset all values to their default value" />
</PreferenceScreen>
只需将以下内容添加到您的
首选项样式中
,然后删除ListSeparatorExtViewStyle
<item name="android:listDivider">@color/text_color_dark</item>
<item name="android:dividerHeight">1dp</item>
@color/text\u color\u深色
1dp
您找到解决方案了吗?
setTheme(R.style.PreferenceStyle);
<item name="android:listDivider">@color/text_color_dark</item>
<item name="android:dividerHeight">1dp</item>