我尝试自定义首选项类别的背景颜色。我已经改变了首选项本身的背景颜色,但我找不到如何更改类别背景颜色的方法。
我找到了两种方法,但它们对我不起作用:changing the preference category label color background
通过this link,我找到了this,但我尝试过的任何东西都没有。这些布局片段是我到目前为止尝试过的:
<resources>
<style name="setBackgroundTheme" parent="android:Theme">
<item name="android:background">@color/darkbluelogo</item>
</style>
</resources>
在onCreate
方法中,我将主题设置为:
setTheme(R.style.setBackgroundTheme);
使用背景颜色自定义布局文件,将其设置在PreferenceCategory中:
<PreferenceCategory
android:layout="@layout/your_layout">