关于这个原因:是因为在下拉加载的时候 在给适配器设置数据的过程中,调用
1、recyclerViewAdapter.notifyDataSetChanged();这个方法,它会重新绘制布局,切记不能setnewdata方法添加数据
定义一个总的集合,将上一次的数据添加进去,然后通过addData设置进去,就OK了。
2、还有一种情况,adapter的初始化不要放在refresh的里面,不然每次刷新都会走adapter的初始化,会导致数据只会加载新数据
布局: <com.scwang.smartrefresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" app:srlAccentColor="#00000000" app:srlPrimaryColor="#00000000" android:id="@+id/refreshLayout" app:srlEnablePreviewInEditMode="true"> &l