Android GridLayoutManager with both column and row span
Asked Answered
C

1

10

I'm using GridLayoutManager(GLM) in my RecyclerView. In the RecyclerView, I will populate the CardViews, how can I set my GLM to render only one CardView in the whole screen ?

If I set the span size as 1, it renders one CardView per row, not whole screen.

In Simple, I want to show 1 CardView occupying two columns and two rows. How to achieve this ?

Cavuoto answered 22/5, 2015 at 7:3 Comment(2)
Did you find a solution for this?Nolita
Could you please post your recycler view item layout? I think if you simply set height of root view in item layout to "match_parent", it will do what you want. However, if you want to divide screen 2x2 grid and want to show one item occupying all these grids, you need to us StaggeredGridLayoutManager.Nihility
G
-1

Just double the height of the card for it to take the space of 2 rows. The height of each row is dependent on the single item you inflate (in your case a cardView).

Grantland answered 13/4, 2017 at 10:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.