I made a Horizontal RecyclerView and it works fine(thanks to this) but the direction of scroll and data are expand from left to right; then How can I change the RecyclerView scroll direction like in the picture below?
My Code:
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager( 2, //The number of Columns in the grid LinearLayoutManager.HORIZONTAL);
LayoutManager implementations that lays out items in a grid. WearableLinearLayoutManager. This wear-specific implementation of LinearLayoutManager provides basic offsetting logic for updating child layout. A RecyclerView. LayoutManager implementation which provides similar functionality to ListView .
You can add an indicator by using RecyclerView. ItemDecoration. Just draw some lines or circles at the bottom and use layoutManager. findFirstVisibleItemPosition() to get the current active item.
Assuming you use LinearLayoutManager
in your RecyclerView, then you can pass true
as third argument in the LinearLayoutManager constructor.
For example:
mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true));
If you are using the StaggeredGridLayoutManager
, then you can use the setReverseLayout
method it provides.
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