Reputation: 31
How to implement horizontal grid recycler view by horizontal span like this:
What i want
I use StaggeredGridLayoutManager
and GridLayoutManager
but the result is:
Result
Upvotes: 3
Views: 1895
Reputation: 1
Use
GridLayoutManager(context, NUMBER_OF_COLUMNS, RecyclerView.VERTICAL, false)
If you want to keep specific number or rows calculate the number of columns dynamically
Upvotes: 0
Reputation: 6089
You can use StaggeredGridLayoutManager with the span value 3 and horizontal orientation as below
StaggeredGridLayoutManager mLayoutManager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.HORIZONTAL);
recyclerView.setLayoutManager(mLayoutManager);
Upvotes: 1