How to enable a preference in my android application when other preference is disabled?

后端 未结 4 1433
既然无缘
既然无缘 2021-01-01 13:52

I have used PreferenceActivity to have preference in my android application. I want one preference say \"pref 2\" to be enabled when other preference say \"pref

4条回答
  •  既然无缘
    2021-01-01 14:28

    According to the docs here, you can add an attribute to the CheckBoxPreference tag like so:

    android:disableDependentsState="true"
    

    By default this is false, which means that the dependents are disabled when the checkbox is unchecked, but by setting it to true, it should have the opposite effect.

提交回复
热议问题