Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>

In onCreate method I set the theme with:

setTheme(R.style.setBackgroundTheme);
like image 317
Bruno Bieri Avatar asked Feb 20 '23 13:02

Bruno Bieri


1 Answers

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

<PreferenceCategory
    android:layout="@layout/your_layout">
like image 185
cycDroid Avatar answered Mar 03 '23 10:03

cycDroid