truizlop / SectionedRecyclerView

An adapter to create Android RecyclerViews with sections, providing headers and footers.
806 stars 144 forks source link

How to create custom view for different sections #23

Open Feroz-Istar opened 7 years ago

Feroz-Istar commented 7 years ago

How to create custom view for different sections

truizlop commented 7 years ago

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.

Feroz-Istar commented 7 years ago

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

truizlop commented 7 years ago

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.

matthew-niemann commented 6 years ago

I think he means getSectionItemViewType.