Reshaud Ally
Reshaud Ally

Reputation: 321

How to implement Horizontal RecyclerView With Header in my Android app

enter image description here

I would like to know the best approach to create an interface similar to the one in the image. I am using the FirestoreRecyclerAdapter to populate my list. Should I have a TextView for each category an then a RecyclerView under that category? I have multiple view types one for the header an one for items but I would have to know when to add a header in between the items. Also note for my purposes a item can fit multiple categories.

Upvotes: 0

Views: 847

Answers (1)

Reaz Murshed
Reaz Murshed

Reputation: 24211

Here's a tutorial for implementing such RecyclerView. You might also consider looking at the github repository as well.

The idea is simple and effective which is described in the tutorial. You need a mother RecyclerView inside a NestedScrollView. The parent RecyclerView will have child RecyclerView holding the items to be shown in each row. Just follow the implementation of the SnapAdapter and the Adapter class for the mother and child RecyclerView respectively.

Upvotes: 2

Related Questions