Showing posts with label NestedScrollView With RecycleView Problem. Show all posts
Showing posts with label NestedScrollView With RecycleView Problem. Show all posts

Thursday, December 5, 2019

NestedScrollView With RecycleView Problem


When we have multiple Recycle View in NestedScrollView. Most of the times top views hide behind the toolbar and Recycle View Data comes on top. For resolving these problems use Layout like below ....
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">

<LinearLayout
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

 <TextView/>

 <EditText/>

 <Button />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycle"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:nestedScrollingEnabled="false" />

 </LinearLayout>

</android.support.v4.widget.NestedScrollView>
and use this line in your Activity or Fragment.
    RecyclerView  mList = view.findViewById(R.id.recycle);
    ViewCompat.setNestedScrollingEnabled(mList, false);