Projit Roy
Projit Roy

Reputation: 19

Recyclerview not scrolling all elements of list inside nested scrollview

Recyclerview not scrolling all the elements of adapter inside nested scroll view. If I use Recyclerview without nested scrollview it works fine.

After searching many solution set the layout_height to warp content of recyclerview and nested scrollview.

here's my layout

<androidx.coordinatorlayout.widget.CoordinatorLayout               
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"                
 android:layout_height="match_parent"
 xmlns:app="http://schemas.android.com/apk/res-auto">

            <com.google.android.material.appbar.AppBarLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:theme="@style/AppTheme.AppBarOverlay"
              tools:ignore="Missing Constraints">
            <androidx.appcompat.widget.Toolbar
              android:id="@+id/transactionHistoryToolbar"
              android:layout_width="match_parent"
              android:layout_height="?attr/actionBarSize"
              android:background="@color/groupColor"
              android:elevation="@dimen/_2"
              android:theme="@style/AppTheme.PopupOverlay">
            </androidx.appcompat.widget.Toolbar>
            </com.google.android.material.appbar.AppBarLayout>

           <androidx.core.widget.NestedScrollView
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:isScrollContainer="true"
             android:measureAllChildren="true"
             app:layout_behavior="@string/appbar_scrolling_view_behavior">

           <androidx.constraintlayout.widget.ConstraintLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginBottom="@dimen/_2">

             <TextView/>
              //other views
                <LinearLayout/>

                 <TextView/>

                    <LinearLayout/>

               <TextView/>

                       <LinearLayout/>

                 <Button
                  />

                  <androidx.recyclerview.widget.RecyclerView
                     android:id="@+id/shipmentList"
                      android:layout_width="match_parent"
                      android:layout_height="0dp"
                     android:layout_marginTop="@dimen/_10"
                     android:layout_marginLeft="@dimen/_7"
                    android:layout_marginRight="@dimen/_7"
                     android:clickable="true"
                     android:visibility="gone"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">             
        </androidx.recyclerview.widget.RecyclerView>
                   <TextView/>
                   </androidx.constraintlayout.widget.ConstraintLayout>          
                  </androidx.core.widget.NestedScrollView>

                  </androidx.coordinatorlayout.widget.CoordinatorLayout>

Upvotes: 0

Views: 944

Answers (2)

MEHUL
MEHUL

Reputation: 49

you can also set this line

ViewCompat.setNestedScrollingEnabled(recyclerView, false); to your adapter as we write in xml and i have same issue so i refereed one link that i am sharing with you https://android.jlelse.eu/recyclerview-within-nestedscrollview-scrolling-issue-3180b5ad2542

Upvotes: 2

Projit Roy
Projit Roy

Reputation: 19

I have found the solution. Main problem with constraintLayout. after replacing with Relative Layout it works fine.

Upvotes: 0

Related Questions