user755193
user755193

Reputation: 21

How to grey out entry items in a ListPreference

I have a PreferenceActivity where 3 ListPreferences are present.

Each ListPreference has some entries(2 or 3).

I want to show only 1 entry highlighted and the rest greyed out in one of the ListPreference.

What changes do I need to do in PreferenceActivity if I change ListPreference to some CustomeListPreference?

Where do I start? Can anybody help me figure out what to do?

Upvotes: 2

Views: 2765

Answers (1)

Will Tate
Will Tate

Reputation: 33509

Since ListPreference inherts Preference you should be able to first set setShouldDisableView() to true. Then, set setEnabled() to false. This should make the item appear disabled (grey) and not clickable.

Upvotes: 5

Related Questions