使用StaggeredGridLayoutManager后会出现卡顿,滑动到最后一个时可能出现截取一半的情况
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(spanCount, orientation); staggeredGridLayoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE); staggeredGridLayoutManager.setItemPrefetchEnabled(false); <com.scwang.smart.refresh.layout.SmartRefreshLayout android:id="@+id/mySmartRefresh" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" app:layout_constrainedHeight="true" app:srlEnableAutoLoadMore="false" app:srlEnableFooterFollowWhenLoadFinished="true" app:srlEnableLoadMore="false" app:srlEnableLoadMoreWhenContentNotFull="false" app:srlFinishDuration="0" app:srlFooterHeight="@dimen/dp_40" app:srlFooterMaxDragRate="40" app:srlReboundDuration="100">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/color_f6f6f6"
android:focusable="false"
android:focusableInTouchMode="false"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
android:paddingEnd="@dimen/dp_8"
app:itemAnimator="@{null}"
app:itemBinding="@{viewModel.itemBinding}"
app:items="@{viewModel.itemVMList}"
app:layoutManager="@{LayoutManagers.staggAeredGrid(2,StaggeredGridLayoutManager.VERTICAL)}" />
</com.scwang.smart.refresh.layout.SmartRefreshLayout>