2

Curently I'm using ViewPager to achieve Horizontal and Vertical Scrolling in a RecyclerView with LinearLayoutManager set to LinearLayoutManager.VERTICAL.

Is there any better approach to do the same?

Anirudh
  • 2,767
  • 5
  • 69
  • 119
  • Did you receive any feasible solution for same? – Beena Apr 21 '16 at 10:15
  • Please try this solution https://irpdevelop.wordpress.com/2016/02/10/horizontal-recyclerview-inside-a-vertical-recyclerview/ – jettimadhuChowdary Feb 14 '17 at 06:10
  • 3
    Does this answer your question? [Create a RecyclerView with both horizontal and vertical scrolling](https://stackoverflow.com/questions/36408266/create-a-recyclerview-with-both-horizontal-and-vertical-scrolling) – Prashant Dange Aug 17 '20 at 20:05

2 Answers2

0

you have to set layout manager to recycler view with orientation as Horizontal

recyclerView.setLayoutManager(new LinearLayoutManager(getOmniActivity(), LinearLayoutManager.HORIZONTAL, false));
Prasanna Anbazhagan
  • 1,693
  • 1
  • 20
  • 37
0

You cant set both horizontal and vertical at a time, you can set either....if you want same approach then use vertical scrollbar with horizontal recyclerview.

You can create horizontal recyclerview as

    LinearLayoutManager layoutManager
    = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);

RecyclerView myList = (RecyclerView) findViewById(R.id.my_recycler_view);
myList.setLayoutManager(layoutManager);
H Raval
  • 1,903
  • 17
  • 39