I am using Recycler View (with Card View) from Android v7 support library with StaggeredGridLayoutManager. What I want to achieve is to display cards in Recycler View with fixed row height, but still in vertical mode (vertical scrolling). Do you know if this is possible and if yes how?
Asked
Active
Viewed 1,311 times
1 Answers
0
you can use this lines:
recycleview.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
recycleview.setHasFixedSize(true);
here is the best example of what you are talking about: Cardview with grid

Sagar Chavada
- 5,169
- 7
- 40
- 67
-
Thanks for the answer, but that's not quite what I'm thinking of. The question is how to have different spans in different rows? As in the example, if we can manage to put 2 images in the row then we have 2, but if we manage to put 3 of them then in this particular row how to have 3. – Michał Aug 10 '16 at 12:17
-
if you have 3 row then cardview automatically became small bcz recyclerview has fix size – Sagar Chavada Aug 10 '16 at 12:29