change background color of Preference

You can define a theme and then set this for your PreferenceActivity in the manifest. Your theme can then define a a background color or a windowBackground image should you prefer that.

Manifest:

    <activity android:label="@string/app_label" android:name=".client.PreferencesActivity"
        android:theme="@style/PreferencesTheme">
        <intent-filter>                                
        </intent-filter>
    </activity>

Then add the theme to your styles.xml

<style name="PreferencesTheme">
    <item name="android:windowBackground">@drawable/background_image</item>
    <item name="android:background">#FFEAEAEA</item>
</style>

In the above snippet there’s both a background color and a background image defined to show how to do it.

Leave a Comment