0

I have a PreferenceScreen with multiple PreferenceCategory that have many CheckBoxPreferences in them. I'm trying to create an expandable list concept by hiding or displaying a category on click of the preference category label. I can implement the click listener but there's no way to set the visibility for a CheckBoxPreference as far as I know apart from using addPreference and removePreference but since the layout is completely built in xml (required to do so) I can not add preferences to the correct category without causing force closes. Is there a way instead to somehow treat the CheckBoxPreference as a View and change its visibility to GONE or VISIBLE as needed? Or is there an alternate method to accomplish what I'm trying to do? Thanks.

1 Answers1

0

Its an old thread, but just for other people reference:

You need to write a custom CheckBoxPreference class as you can't change the parameters for checkBoxPreference directly from code. Calling the parameters from the custom class works.

One other thing you could do is to use PreferenceFragment for each PreferenceCategory you want to make visible and vice versa.

AliR
  • 2,065
  • 1
  • 27
  • 37