Reputation: 1874
The Items should look like this: RecyclerView items as grid
Upvotes: 0
Views: 94
Reputation: 962
Assuming an arbitrary number of columns and rows, you could try using this library with a FlexboxLayoutManager for your RecyclerView. As you noted, you could also use a GridLayoutManager in case your columns are fixed.
Upvotes: 2
Reputation: 1874
It's simply can be done using GridLayoutManager insted of LinerLayoutManager and without nested RecyclerView or any additional Layout like this:
RecyclerView.LayoutManager mRecyclerGrid=new GridLayoutManager(this,3,LinearLayoutManager.VERTICAL,false);
mRecyclerView.setLayoutManager(mRecyclerGrid);
You can set how many items should appear on a row (replace the 3).
Upvotes: 0