Reputation:
How to implement Nested recyclerview in android. I have to implement one recyclerview containing two buttons and inside that recyclerview again in second recyclerview two images have to be there how to implement this can anyone suggest me i am new to android
Upvotes: 0
Views: 243
Reputation: 1
Yes we can implement Nested RecyclerView in Android Studio
Just make a Child Adapter and its xml layout and set that adapter inside the Parent Adapter. You can refer to our blog if your have any doubt.
How to Implement Nested RecyclerView in Android
Upvotes: 0
Reputation: 3803
You cannot place a RecyclerView
inside another RecyclerView
within a layout xml file. But you can programatically attach a RecyclerView
into another one. For example by attaching Layouts programatically. Then you would have two scrollable RecyclerView
s. This may sometimes be a thing you don't want to have. For example because of CollapsingToolbarLayout
s. Then you can deactivate nested scrolling of the inner RecyclerView
by
mRecyclerView.setNestedScrollingEnabled(false);
But if you disable scrolling you will lose the performance advantage of the RecyclerView
because the inner one does not recycle anymore if it is not scrollable. But maybe you just need something like this SectionedRecyclerViewAdapter.
Upvotes: 2