StickyHeaders icon indicating copy to clipboard operation
StickyHeaders copied to clipboard

How to set all sections are collapsed by default

Open EzimetYusup opened this issue 8 years ago • 3 comments

hey, do you have any good idea about how to set All sections collapsed by default, currently all the sections are open by default. Thanks!

EzimetYusup avatar Oct 10 '16 16:10 EzimetYusup

Right now you can call the method SectioningAdapter:: setSectionIsCollapsed and manually collapse each section. I will consider some option to cause sections to be collapsed by default

ShamylZakariya avatar Oct 13 '16 16:10 ShamylZakariya

Where do we call setSectionIsCollapsed? If I do it in onBind.. it complains that I can't do that while RecylerView hasn't finished drawing, if I do it elsewhere it will have already laid out the section first and then begin the closing animation, which looks weird and jumpy.

Aditya94A avatar Feb 10 '18 10:02 Aditya94A

@AdityaAnand1 You can do this before assign you adapter to recycleview. For example for (int i = 0; i < adapter.getNumberOfSections(); i++) { adapter.setSectionIsCollapsed(i, true); } recyclerView.setLayoutManager(new StickyHeaderLayoutManager()); recyclerView.setAdapter(adapter);

genius38ru avatar Apr 13 '18 17:04 genius38ru