MiguelCatalan MiguelCatalan - 4 months ago 17
Android Question

Change selector color of a Preference

I couldn't find any info related.

I have implemented my custom theme with Android-holo-colors assets in the rest of my app without any problems, until I began developing the PreferenceActivity.

I just can't find how can I change the selector color of any preference, it's remains the default value (Holo-blue).

Any ideas?

Thanks BTW.

EDIT:
I tried to set the main theme in the Activity label at the Manifest, but does not worked for me. I presume that is because I didn't specify nothing that overwrites any Preference style, but that's my problem, I don't know which ones I have to overwrite.

Answer

In your PreferenceActivity onCreate, after you have added your preferences, call:

getListView().setSelector(R.drawable.your_selector);
Comments