Recyclerview не прокручивает все элементы списка внутри вложенного прокрутки

Recyclerview не прокручивает все элементы адаптера внутри вложенного представления прокрутки. Если я использую Recyclerview без вложенной прокрутки, он работает нормально.

После поиска многих решений установите layout_height для деформации содержимого recyclerview и вложенного прокрутки.

вот мой макет

<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>

person Projit Roy    schedule 13.08.2019    source источник
comment
добавьте свой файл класса java/kotlin в свой вопрос.   -  person Sneha Sarkar    schedule 13.08.2019
comment
Почему высота макета для recyclerview 0dp? Вы также отключили этот recyclerview.setNestedScrollingEnabled(false);?   -  person sanjeev    schedule 13.08.2019
comment
recyclerView.setHasFixedSize (истина); recyclerView.setNestedScrollingEnabled (ложь); эти две строки необходимо добавить в файл класса.   -  person Sneha Sarkar    schedule 13.08.2019
comment
обе строки добавлены в мой файл класса @SnehaSarkar   -  person Projit Roy    schedule 13.08.2019
comment
да у меня есть @sanjeev   -  person Projit Roy    schedule 13.08.2019


Ответы (2)


вы также можете установить эту строку

ViewCompat.setNestedScrollingEnabled (recyclerView, false); к вашему адаптеру, поскольку мы пишем в xml, и у меня такая же проблема, поэтому я сослался на одну ссылку, которой я делюсь с вами https://android.jlelse.eu/recyclerview-within-nestedscrollview-scrolling-issue-3180b5ad2542

person MEHUL    schedule 17.08.2019

Я нашел решение. Основная проблема с limitedLayout. после замены на Relative Layout он работает нормально.

person Projit Roy    schedule 13.08.2019