Closed johnernest02 closed 5 years ago
I am also using Kotlin by the way
@dev-JE02, the HeaderItem is mainly for sticky headers, if you don't need the sticky functionality you can use a normal ExpandableItem with subItems that in turn can be expanded as well for the 3rd level. You should use ExpansionLevel in the items definition, it should work.
Okay but when adding to the adapter, am I supposed to use addItemToSection
?
Because I am finding it hard to put the 3rd level items and such inside the 2nd level sections as the 2nd level sections are normal ExpandableItems
. Am I doing something wrong?
I found that ExpandableItems
has addSubItem
method and subItems
fields that I can use to add subItems. Thank you very much for the help
@dev-JE02, yes there are such methods for subItems, but pay attention that if you add them expanded (already visible), adapter must be called also with addItemToSection
: Read Headers-and-Sections#following-the-use-case-2. Otherwise you don't need to call this method.
Basically, is it possible?
I have a screen where 1st level items upon click will expand and show 2nd level items below it. The 2nd level items themselves look just like the 1st level items, only difference is a transparent indentation in the left. The 2nd level items themselves can also be clicked and show 3rd level items, which again looks like the 1st and 2nd level items with only another indentation in the left side. The hierarchy depends on the data returned from the database and the levels are not fixed. So I am looking for a solution where I can re-use the header items but I can't seem to wrap my head around how to implement it using the
AbstractExpandableHeaderItem
andAbsractExpandableItem
. I have used this library before but only got until 2nd level items so I quite know the specifics of setting it up