如何与偏好属性 android:dependency 相反?

How to do opposite of of preference attribute android:dependency?(如何与偏好属性 android:dependency 相反?)
本文介绍了如何与偏好属性 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:dependencycode> 将按照我想要的相反方式切换它.

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"

把它放在控制偏好中.

这篇关于如何与偏好属性 android:dependency 相反?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How can create a producer using Spring Cloud Kafka Stream 3.1(如何使用Spring Cloud Kafka Stream 3.1创建制片人)
Insert a position in a linked list Java(在链接列表中插入位置Java)
Did I write this constructor properly?(我是否正确地编写了这个构造函数?)
Head value set to null but tail value still gets displayed(Head值设置为空,但仍显示Tail值)
printing nodes from a singly-linked list(打印单链接列表中的节点)
Control namespace prefixes in web services?(控制Web服务中的命名空间前缀?)