Android set background color of preference category

只谈情不闲聊 提交于 2019-12-04 01:32:46

问题


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>

In onCreate method I set the theme with:

setTheme(R.style.setBackgroundTheme);

回答1:


Custom a layout file with your background color, set it in your PreferenceCategory:

<PreferenceCategory
    android:layout="@layout/your_layout">


来源:https://stackoverflow.com/questions/10546715/android-set-background-color-of-preference-category

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!