Disable some/all radio buttons in Android preference
I have searched and searched Google, Stack Overflow, etc. 开发者_JAVA百科for an answer to this and failed!
I wish to programatically disable/enable selected radio buttons in a single Android preference.
For example, there is a radio button preference with 6 choices, but depending on some condtions (not related to the preferences) some of them will be unselectable and should be shown as disabled.
I can see how we can disable complete radio button groups, but not individual radio buttons
Can Anyone help?
AFAIK, this is not supported by the built-in ListPreference
. You are welcome to write your own custom Preference
, or perhaps extend ListPreference
, where you supply your own Adapter
and disable certain items that way.
精彩评论