【发布时间】:2021-04-11 02:39:41
【问题描述】:
我有 NestedScrollView。在 NestedScrollView 中包含两个 RecyclerView 都垂直滚动。
当第一个 RecyclerView 列表滚动结束/停止然后第二个 RecyclerView 列表开始滚动时。
第一次滚动开始时,屏幕冻结/滚动缓慢。经过一段时间平滑滚动发生。
为什么第一次滚动屏幕会冻结?如何避免屏幕冻结/滚动缓慢?
由于 NestedScrollView,没有连续滚动 onScrollMethod 和 EndlessRecyclerViewScrollListener(用于分页)被调用。如何避免被调用 EndlessRecyclerViewScrollListener 方法。
我正在添加我的布局代码。等待答复。
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:gravity="center"
android:text="First List" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvFirstList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/dimen_4" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:gravity="center"
android:text="Secound List" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/secoundRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/dimen_4" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
【问题讨论】:
标签: android list android-recyclerview pagination android-nestedscrollview