ListPreference - Custom items possible?

2.7k views Asked by At

I'm trying to add an image / icon to certain entries of a ListPreference alongside the text.

I would like achieve this programmatically.

Here's an excerpt of the preferences.xml

<ListPreference
  android:key="prefGameMode"
  android:title="@string/pref_game_mode"
  android:summary="@string/pref_game_mode_desc"
  android:defaultValue="fourChallenge"
  android:entries="@array/arrGameMode"
  android:entryValues="@array/arrGameModeValues" 
  android:negativeButtonText="@string/cancel" />
...

The goal here is to illustrate that some of the options listed are unavailable/ locked in the current version of the app. However, the code-base is used as a library, so I would like the solution to work via code, rather than xml.

Any ideas how to do this? Thanks.

1

There are 1 answers

1
Cheryl Simon On

Preferences already gives you a way to indicate that an option is unavailable: just set enabled properly.