Rahul Chaurasia Rahul Chaurasia -4 years ago 153
Android Question

Google play store like interface using recycler view

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?

Answer Source

Dont use nested listviews (you cant scroll horizontally in play store).

Consider the following options:

  1. You can use a simple LinearLayoutManager and make different view types. For the with 3 cards horizontally use a 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 adapter
  2. Write your own LayoutManager for RecyclerView
  3. Use TwoWay View which is based on RecyclerView and offers a Spannable Grid Layout manager, which seems to be what you are looking for.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download