Closed StephenMilone closed 7 years ago
It is possible, in your adapter create flag array for show/hide state. In getSectionItemCount return 0 if section is hidden. Add click listener to header view in onBindHeaderViewHolder, flip state flags on click and finally reload all items with notifyAllSectionsDataSetChanged.
The only problem with this solution, current scroll position will jump to incorrect position(for example when you collapse section and header is sticky). You must somehow catch those situations and set correct scroll position.
Thanks, I'll test it out today!
Thanks this is working great for me...but instead of using notifyAllSectionsDataSetChanged, i'd prefer to use notifySectionItemRangeRemoved/ notifySectionItemRangeInserted so it uses animation. but it appears notifySectionItemRangeRemoved has private access. Can this be updated?
The scroll position isn't an issue for my project
Access level fixed in 0.9.5
Is it possible to expand and collapse sections dynamically? I'd like to add click listeners to the headers that hide/show the items in it, but can't find a solution at the moment. Let me know if you need any more info. thanks!!