Android设置首选项类别的背景颜色 [英] Android set background color of preference category
问题描述
我尝试自定义首选项类别的背景颜色.我已经更改了首选项本身的背景色,但找不到改变类别背景色的方法.
I try to customize the background color of preference categories. I already changed the background color of a preferences itself but I can't find a way how to change the the categories background color.
我发现了两种方法,但它们对我不起作用: 更改首选项类别标签的颜色背景
I found two ways but they don't works for me: changing the preference category label color background
通过此链接,我找到了
Through this link, i found this, but nothing I've tried worked for me. These layout snippet is what I've tried so far:
<resources>
<style name="setBackgroundTheme" parent="android:Theme">
<item name="android:background">@color/darkbluelogo</item>
</style>
</resources>
在onCreate
方法中,我将主题设置为:
In onCreate
method I set the theme with:
setTheme(R.style.setBackgroundTheme);
推荐答案
使用背景色自定义布局文件,然后在您的PreferenceCategory中进行设置:
Custom a layout file with your background color, set it in your PreferenceCategory:
<PreferenceCategory
android:layout="@layout/your_layout">
这篇关于Android设置首选项类别的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!