How to show and hide preferences on Android dynamically?

后端 未结 6 799
隐瞒了意图╮
隐瞒了意图╮ 2020-12-23 17:46

Is there a way to dynamically show and hide preferences? In my case, I have a checkbox preference that would disable or enable one of 2 preference groups (\"with-\" and \"w

6条回答
  •  一向
    一向 (楼主)
    2020-12-23 18:17

    Not exactly hiding/showing but if you only want disabling/enabling preference depending on another preference you can specify android:dependency="preferenceKey" or Preference.setDependency(String)

    Example from developer.android.com:

    
    
        
        
    
    

提交回复
热议问题