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?
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?
you have to set layout manager to recycler view with orientation as Horizontal
recyclerView.setLayoutManager(new LinearLayoutManager(getOmniActivity(), LinearLayoutManager.HORIZONTAL, false));
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);