How to display recycle view items in three rows and three columns using grid layout manager horizontally that add value vertically increase similar to the following figure
1 4 7
2 5 8
3 6 9
How to display recycle view items in three rows and three columns using grid layout manager horizontally that add value vertically increase similar to the following figure
1 4 7
2 5 8
3 6 9
Use RecyclerView with adapter and write this line:
final GridLayoutManager manager = new GridLayoutManager(getContext(),3);
catProRecycleView.setLayoutManager(manager);
catProRecycleView.setAdapter(categoryProductAdapter);
You need to specify that your GridLayoutManager is HORIZONTAL. Like this:
gridLayoutManager = new GridLayoutManager(getContext(), 3, GridLayoutManager.HORIZONTAL, false);
3 is number of rows.