SmartRefreshLayout
SmartRefreshLayout copied to clipboard
SmartRefreshLayout + NestedScrollView 嵌套 RecyclerView 时,RecyclerView 加载更多卡顿
布局如下:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fl_topview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:orientation="vertical"
tools:context=".job.recommend.RecommendFragment">
<FrameLayout
android:id="@+id/relay_positionlist"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srlAccentColor="@color/colorPrimary"
app:srlEnablePreviewInEditMode="true">
<com.base.view.CommonRefreshHeader
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.widget.NestedScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<include layout="@layout/recommend_head" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<com.base.view.CommonRefreshFooter
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
<ImageView
android:id="@+id/top_images"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp"
android:paddingBottom="20dp"
android:src="@drawable/returntop"
android:visibility="gone" />
<LinearLayout
android:id="@+id/ll_tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical" />
</FrameLayout>
<include layout="@layout/order_related" />
</FrameLayout>
当 RecyclerView 中已有100条左右的数据时,再加载更多,会有明显卡顿,而且 RecyclerView 中已有条目越多,卡顿时间越久,猜测是加载更多后重新测量导致的,请问有没有解决的方法?
唯一的办法就是去掉 NestedScrollView
唯一的办法就是去掉 NestedScrollView
有别的办法吗?