http://developer.android.com/reference/android/preference/Preference.html#attr_android:dependency
if I want my list to be dependent from other check preference named on_off I can do this
<ListPreference
android:defaultValue="100"
android:dependency="on_off"
android:dialogTitle="text"
android:entries="@array/display_values"
android:entryValues="@array/entry_values"
android:key="preferences_text"
android:summary="text"
android:title="text" />
and every time when the check preference on_off have value false this list preference will be disabled.
But what If I want everytime when on_off is true the list preference to be disabled ? I need something like logical NOT for the android:dependency
is this possible ?
In preference XML, set android:disableDependentsState
attribute of the "on_off"
CheckBoxPreference
to true
. E.g.:
<CheckBoxPreference
android:disableDependentsState="true"
android:key="on_off"
android:summaryOff="Dependent is enabled"
android:summaryOn="Dependent is disabled"
android:title="Checkbox that disables its dependents state in reverse manner" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With