StickyHeaders
StickyHeaders copied to clipboard
How to set all sections are collapsed by default
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!
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
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.
@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);