简体   繁体   中英

How to make some item unselectable in ListPreference

At the PreferenceActivity has a listPreference. And I already setup the entries (eg "A" to "E") and entriesValues by programming method(not in xml).

is it possible to make some entry items unselectable which refer to the system version.

For regular list items you may just return false for the 'boolean isEnabled (int position)'. This will make the item non clickable.

Use setSelectable(false) on the Preference object. See also http://developer.android.com/reference/android/preference/Preference.html

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