0

enter image description here

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)

1 Answers1

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