且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

preferences被启用依赖于其他preference

更新时间:2023-02-03 20:53:30

您可以使用依赖属性做到这一点。在你的 preference XML,你将下面的行添加到您的 checkbox_ preF2 checkbox_ preF3 checkbox_ preF2 preferences:

You can do this with the dependency attribute. In your Preference XML, you would add the following line to your checkbox_pref2, checkbox_pref3, and checkbox_pref2 Preferences:

android:dependency="checkbox_pref1"

相关链接:

Android快速preferences教程

Android preference文档(#dependency)