RecyclerView grid with different item sizes
Asked Answered
E

2

12

I need to create a horizontal scrolling grid that can allocate items with different width and different height. StaggeredGridLayoutManager can handle different width but it won't let me have items with different height. Is there any LayoutManager implementation which can do what I need?

Ecumenicist answered 5/12, 2014 at 11:9 Comment(0)
J
9

Unfortunately, there's no LayoutManager for that yet. You'll have to implement you own LayoutManager from scratch. The currently available LayoutManagers (as of december 2014) are:

  1. LinearLayoutManager
  2. GridLayoutManager
  3. StaggeredGridLayoutManager

https://developer.android.com/reference/android/support/v7/widget/RecyclerView.LayoutManager.html

EDIT:

You can also look at this if you want to implement your LayoutManager in an easier way...

Jacaranda answered 15/12, 2014 at 19:25 Comment(1)
I need to implement this kind of logic also. Did you find any solution for this issue ?Socialism
B
0

As mentioned earlier there isn't LayoutManager with such functionality. You can use GridLayout, or create own LayoutManager. My answer can be helpful to find out how to lay out items with different size: https://mcmap.net/q/1011205/-creating-a-variable-column-size-layout-manager-for-recyclerview

Ballroom answered 20/3, 2016 at 6:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.