Is it possible to change background color of Preference

by Vincent » Tue, 16 Feb 2010 19:33:17 GMT

Sponsored Links

Does anybody know how to change the background color of Preference
(PreferenceCategory, EditTextPreference ...) ?

I wanna do like this:
<PreferenceCategory android:title="title_test"
But this doesn't work...
I searched these by using google, but couldn't find any right

Also, I couldn't find any way to change other layouts. (e.g. text
color, size and style of preference title or summary)
Is there no way to customize the layout of Preferences?
It'll be great if somebody can help me out.

thanks in advance!


Is it possible to change background color of Preference

by Bob Kerns » Wed, 17 Feb 2010 00:23:02 GMT

 I think you'll need to supply the android:layout attribute, and supply
an alternative layout with the background set.

You can find the default layout in the SDK at platforms/android-2.1/

If you just want to customize the widget portion, use
android:widgetLayout instead, but this sounds like you want to affect
the entire preference.


Sponsored Links

Is it possible to change background color of Preference

by joebowbeer » Wed, 17 Feb 2010 05:51:28 GMT

 Something like this:

public class MyPreferenceActivity extends PreferenceActivity {

    protected void onCreate(Bundle savedInstanceState) {

I'm not sure if the listView changes are necessary or advisable.



Is it possible to change background color of Preference

by skink » Wed, 17 Feb 2010 07:09:36 GMT


i'm afraid it works only for top-level preferences.

if you have inner ScreenPreferences it won't work as ScreenPreferences
use Dialogs in order to show their child Preferences



Is it possible to change background color of Preference

by Vincent » Wed, 17 Feb 2010 13:31:50 GMT

 Bob, joebowbeer, skink

Thanks so much for your help!!
I successfully managed to change the layout of preference.

As joebowbeer wrote, I changed the top-level background image and
listview setting in my code like below.

Then, I supplied the custom layout to the android:layout attribute in
xml in order to change other child preferences as Bob stated.
    <PreferenceScreen xmlns:android=" 
        <PreferenceCategory android:title="test_title"

Thank you very much!!


Other Threads

1. Complete list of shell commands supported by android

is there a complete list, or there is no guarantee the list won't
change with every release?


2. Solusi canggih sync phonebook

Manual sync?


"Indonesian Android Community [id-android]"

3. restore backup sms (.txt) ke spica

4. Nubie Questions About Flashing Magi

5. Google Maps API: How to detect when the user has stopped panning the map

6. Sqlite delete row problem

7. Isi data owner