Nested Recyclerview - nested

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

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 RecyclerViews. This may sometimes be a thing you don't want to have. For example because of CollapsingToolbarLayouts. 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.

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

Related

How can the RecyclerView adapter talk back to parent layout?

I got a parent layout, activity_main.xml, with multiple views inside it, one of which is the RecyclerView view.
Within the recycler view, there are buttons that, once the user deals with them, I would like things to happen in the parent layout that is activity_main.xml.
For example, if I press a button on a ViewHolder item inside the child RecyclerView, in some cases, I would like changes to happen in the parent activity_main.xml layout.
However, my problem is that I don't know how to allow for this communication to happen.
What might be the best practices for such cases?
You need to create an interface callback or use a higher-order function.
This Stack Overflow answer is an example of an interface callback:
How to access component of MainActivity in recycler view to make onclick listener?.
Kotlin Lambda Functions For RecyclerView Adapter Callbacks in Android is for higher-order functions.

MotionLayout does not pass nested scroll up to parent

I am using 'com.android.support.constraint:constraint-layout:2.0.0-alpha5'.
I have a fragment using MotionLayout inside an activity that also carries a BottomNavigationView inside a CoordinatorLayout with a custom behaviour allowing to show and hide when the content is scrolled.
With all fragments, where there is no MotionLayout, this behaviour works perfectly. Only with the MotionLayout, which has a NestedScrollView as a child, and makes use of an onSwipe transition, this swipe seems to be consumed, and does not arrive at the activity's coordinator layout.
Is this a current limitation of how MotionLayout works, and is it possible to extend it to support my use case?

Nested scroll view set Disable not working

Respected Android Programmer,
I am facing the one major problem is that nested scroll view not get disable. Here I am using RecylerView inside the Nested ScrollView.
Actually I am using the so many fragments in one Activity so when default recylerview loaded the listing user the Nested Scrolview now i have to click on floating button i have to hide the that fragment with with trance parent layout or frame layout. Its done but now problem is that when i use all function of recycler like
NestedScrollView mScrollView;
mScrollView.setNestedScrollingEnabled(false);
Not working may i know the reason.
Best
Romesh Chand

How to create an custom View for ListView?

How to create an custom ListView? I have Adapter, but I don't understand how to create an View like ListView of the Facebook, or App for SMS native from device... I'm needing background for TextView, this background, will have an arrow pointing left or right, I tried to create a View using canvas, but it is very difficult...
Every line in the listView of a layout which can be as complex as you want.Just you need an extra xml file for managing you custom layout (it should be contains widgets,fields,images etc as your design ) and the adapter would inflate this layout file for each row in its getView () method and assign the data to the individual views in the row .

List view inside scroll view design

I have a UI design which should contain a text data and this can be dynamic so i need a scroll view after the TextView is over i need a list view, Now this list view onItemClick of a cell should expand and contract to show details, Any sample project or code from where i can achieve this UI design, Please help me with this one.
It is strongly not recommended to have Nested Views that scroll.
What you can do is have a TextView followed by the ListView. You can use expandable listView for your expansion requirement. All the examples are present in APIDemos shipped with Android SDK.
Try some of the stuff and get back for more help here.

Resources