I want to use a StaggeredGridLayoutManager to have a vertical list with two columns and each row has 3 parts. What exactly should I do?
Asked
Active
Viewed 877 times
1
-
1how about searching before asking? I think that is definitely what you should do. – Vladyslav Matviienko Sep 13 '17 at 06:48
2 Answers
1
try this to use StaggeredGridLayotManager
private StaggeredGridLayoutManager gaggeredGridLayoutManager;
RecyclerView recyclerView = (RecyclerView)findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true);
gaggeredGridLayoutManager = new StaggeredGridLayoutManager(2, 1);
recyclerView.setLayoutManager(gaggeredGridLayoutManager)
here is the tutorial link working with StaggeredGridLayotManager

AskNilesh
- 67,701
- 16
- 123
- 163
0
suppose you want to attach it to a recyclerview, you can add add like this
StaggeredGridLayoutManager staggeredGridLayoutManager=new
StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(staggeredGridLayoutManager);
where recyclerView is the RecyclerView
object

Navneet Krishna
- 5,009
- 5
- 25
- 44