简体   繁体   中英

ListPreference - Custom items possible?

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.

首已经为您提供了一种方式来表示一个选项不可用:刚才设置启用正常。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM