NestedScrollView+嵌套+RecyclerView问题
Describe the bug 使用的是4.1.4开源库和github中demo。 当NestedScrollView+嵌套+RecyclerView 会发现helper = QuickAdapterHelper.Builder(mAdapter) .setTrailingLoadStateAdapter(object : OnTrailingListener { override fun onLoad() { request() }
override fun onFailRetry() {
request()
}
override fun isAllowLoading(): Boolean {
return !viewBinding.refreshLayout.isRefreshing
}
}).build()
中 onload会一直加载。
如果使用helper.trailingLoadStateAdapter?.checkDisableLoadMoreIfNotFullPage();方法 ,则无法自动加载。
重现不中 只需要 把demo中的 activity_load_more.xml布局改成
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"/>
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
请问怎么解决的?
添加 android:nestedScrollingEnabled="false" 也不行
NestedScrollView 禁止嵌套 RecyclerView,Google官方就不建议这样做。这不是本库的问题。
NestedScrollView 嵌套 RecyclerView 会导致 RecyclerView 的复用机制失效!