As on the attached image, I wish to realize this design. In a CoordinatorLayout, there is the AppBarLayout that contains an image and in the bottom life I want to insert two RecyclerViews, one vertical (the first) and the other horizontal (the second down)
Asked
Active
Viewed 398 times
0
-
Please check my answer here https://stackoverflow.com/a/51523216/4978313 – Tiago Ornelas Jul 25 '18 at 16:28
1 Answers
1
When you use a RecyclerView
, you need to specify a LayoutManager
that is responsible for laying out each item in the view. The LinearLayoutManager
allows you to specify an orientation, just like a normal LinearLayout
would.
For vertical recycler view you can use
LinearLayoutManager layoutManager
= new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
mRecyclerView.setLayoutManager(layoutManager);
To create a horizontal list with RecyclerView
, you have to use this:
LinearLayoutManager layoutManager
= new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
RecyclerView myList = (RecyclerView) findViewById(R.id.my_recycler_view);
myList.setLayoutManager(layoutManager);

Anisuzzaman Babla
- 6,510
- 7
- 36
- 53