如何与偏好属性 android:dependency 相反?
是否有与 android:dependency
完全相反的 XML 属性?
Is there XML attribute that does the exact opposite of android:dependency
?
我希望在未选中另一个时启用依赖首选项并在选中时禁用它.
What I would like the dependent preference to be enabled when the other is NOT checked and disabled when it IS checked.
edit:也许问题不在于 android:dependency
也许我可以添加一个 xml 属性以禁用该首选项的默认值,然后 android:dependency
code> 将按照我想要的相反方式切换它.
edit: maybe the issue isn't with android:dependency
maybe there is an xml attribute that I can add to make the default for that preference disabled and then android:dependency
will toggle it the opposite way like i want.
再次我尝试在首选项中设置 android:enabled="false"
并像我想要的那样禁用它,但即使它依赖于其他首选项它也没有像我希望的那样启用它
edit again:
I tried setting android:enabled="false"
in the preference and it disables it like i want but even with it being dependent on the other preference it didn't enable it like i had hoped
推荐答案
实际上是我自己找到的,想把它贴在这里来帮助任何可能遇到同样问题的人:
Actually found it on my own and figured I'd just post it here to help anyone that might have this same issue:
android:disableDependentsState="true"
把它放在控制偏好中.
相关文章