先来看效果
xml中
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--外层嵌套RelativeLayout并设置blocksDescendants属性
是为了让ScrollView来展示RecyclerView的全部数据-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants">
<!-- 历史操作记录-->
<android.support.v7.widget.RecyclerView
android:id="@+id/mRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</ScrollView>
如果只设置xml这些会有滑动冲突,就是滑起来一卡一卡的
activity中
//关闭recyclerview滑动效果,防止滑动冲突
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setNestedScrollingEnabled(false);
完。