У меня есть RecyclerView (ParentRV), который отображает список элементов. Каждый дочерний элемент (ViewHolder) представляет собой RecyclerView (ChildRV), который отображает список элементов.
Затем я реализую библиотеку подкачки для загрузки данных для ChildRV. Проблема заключается в том, что DataSource библиотеки пейджинга продолжает бесконечно вызывать метод loadAfter() после того, как я обновляю результат, возвращаемый из метода loadInitial(), в PagedListAdapter.
Любая помощь, пожалуйста! Вот макеты для ParentRV и ChildRV.
parent_layout.xml
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
// ....
</com.google.android.material.appbar.AppBarLayout>
<com.example.ecommerce.presentation.widget.RefreshLayout
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/sectionList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false" />
</com.example.ecommerce.presentation.widget.RefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
child_layout.xml
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/productList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</FrameLayout>
</layout>
adapter.setHasFixedSize(true)
. stackoverflow .com/questions/30079438/ Кроме того, если оба RecyclerView (родительский и дочерний) имеют вертикальную ориентацию, лучше использовать только один RecyclerView с разными типами представлений. - person Froyo   schedule 11.06.2019