ZakTaccardi ZakTaccardi - 2 years ago 452
Android Question

How do I layout nested RecyclerViews, while remaining performant?

I am trying to achieve something similar to Google Play Music's "Listen Now" layout. Every example I have found on the web is a single, simple

. I am trying to achieve something much more complex. Something like

enter image description here

Can the whole layout (minus the toolbar) be a single
, that contains two more RecyclerViews? Something like

Ultimately, what I want to achieve is a layout like the below, and stay performant.

<RecyclerView> //vertical
<RecyclerView/> //veritcal
<RecyclerView/> //horizontal
<LinearLayout/> //horizontal

Answer Source

you can't take recyclerview inside recyclerview tag. Rather in your first adapter's bindViewHolder call again recyclerview adapter like:-

        InnerRecyclerviewAdapter adapter=new InnerRecyclerviewAdapter(context,urlistArray);
        LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);

wrap_content will also work with latest recyclerview

for more info check out this link

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download