How to implement horizontal gridlayoutmanager with recyclerview. Fixed row count. and horizontal scroll. Like this...
gridLayoutManager = new GridLayoutManager(getContext(), 1, GridLayoutManager.HORIZONTAL, false); recyclerView.setLayoutManager(gridLayoutManager); recyclerView.setHasFixedSize(true);
I try do this. but this is not show anything in item.
Span count refers to the number of columns. This is fairly clunky and doesn't take into account larger screen sizes or screen orientation. One approach is to create multiple layouts for the various screen sizes.
Implement RecyclerAdapter, ViewHolder.
Instantiate RecyclerAdapter
, set its' adapter.
Specify ROWSCOUNT (there are 3 rows on your picture):
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), ROWSCOUNT, GridLayoutManager.HORIZONTAL, false);
Set layout manager: recyclerView.setLayoutManager(gridLayoutManager);
Show your recycler view setContentView(recyclerView);
I've prepared a sample for you, check it out
I just add the affirmation. This picture might proof that Recyclerview with GridLayoutmanager
is available for horizontal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With