简体   繁体   中英

Recycler View scrolling in both direction

RecyclerView with vertical scrolling working fine. now i want that item of RecycelerView should be also scroll in horizontal direction in android. how is it possible?

LinearLayoutManager layoutManager = ...
recyclerView.setLayoutManager(layoutManager);

when you want horizontal

layoutManager.setOrientation(context,LinearLayoutManager.HORIZONTAL,false);

when you want vertical

layoutManager.setOrientation(context,LinearLayoutManager.VERTICAL,false);

You can set the LinearLayoutManager to Horizontal orientation .. Try like this

recyclerView.setLayoutManager(
          new LinearLayoutManager(Activity.this, LinearLayoutManager.HORIZONTAL, false));

Hope this helps

EDIT

Try this

There is FixedGridLayoutManager Which is scrollable in bothways. And also refer this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM