Reputation: 1641
My assignment is to create an interface much same like Google Play Store.There will a Category name followed by 3 or 4 cards (horizontal) followed by More button. Then again next category.
I already had implemented this using nesting the horizontal listview inside Vertical listview.
I know, I can achieve this by using the Recycler view with LinearLayoutManager with horizontal orientation. Using this I'll be having one only row.
My question is how do I add 2nd, 3rd row to this? Should I use again nested Recycler view? Are there some better options?
Upvotes: 9
Views: 6194
Reputation: 5381
You may like to do it as one vertical RecyclerView
(Main recycler) and for every section you can inflate a horizontal RecyclerView
as well (Section recycler) as this blog answer mention:
Also, consider using:
Bitmaps
for persistent access through your other store screensUpvotes: 0
Reputation: 15929
Dont use nested listviews (you cant scroll horizontally in play store).
Consider the following options:
GridLayout
or LinearLayout
with same weights. The problem here is, that you have to consider the indexes of your underlying data list used in the adapterSpannable Grid
Layout manager, which seems to be what you are looking for.Upvotes: 5
Reputation: 101
If you inspect the layout of the Google Play app, they do not use a listview/recyclerview for the horizontal cards. I'm pretty sure that is just a linearlayout (horizontal) within a vertical listview / recyclerview.
If you insist on using a horizontal recyclerview for each row, then having a nested recyclerview would be your best option. You can specify a RecycledViewPool
so that all the nested recyclerviews share the same pool instead of creating their own.
Upvotes: 3