Search code examples
androidexpandablerecyclerview

how to collapse all childviews on expandable recycler view


i have my expandable recyclerview set with two layouts HEADER and CHILD. Everything is working fine.

here is my screen shot.

i have used different layouts for header and child.

when the users click one header, i want my program to check if any other header is expanded. if yes it needs to be collapsed. onclicking one menu the last expanded view should collapse.

i have tried using boolean flag. can anyone please help me


Solution

  • If you use this library to create your expandable sections like in this example, you can loop through the instances of your ExpandableContactsSection and check the flag 'expanded'.