SectionedRecyclerView icon indicating copy to clipboard operation
SectionedRecyclerView copied to clipboard

How to create custom view for different sections

Open Feroz-Istar opened this issue 7 years ago • 4 comments

How to create custom view for different sections

Feroz-Istar avatar May 03 '17 07:05 Feroz-Istar

You need to override getSectionHeaderViewType(see here) and provide different IDs depending on the type of view that you want for a given section. You need to make sure the IDs you provide are different from the ones used by the library. You may also need to override isSectionHeaderViewType (see here) for consistency. Then, bind the different view holders for your section headers.

truizlop avatar May 03 '17 09:05 truizlop

Thanks for your reply. how can we change the sections content view based on different section

Feroz-Istar avatar May 03 '17 09:05 Feroz-Istar

Please, read the docs before opening issues. You have to implement onBindSectionHeaderViewHolder (see here) where you receive holder and section to determine which view you need to render and which content you need to bind. This is out of the scope of the library.

truizlop avatar May 03 '17 09:05 truizlop

I think he means getSectionItemViewType.

matthew-niemann avatar May 24 '18 17:05 matthew-niemann