Indexoutofboundsexception 向上滚动后滑动刷新正在刷新

Indexoutofboundsexception after scrolling up while swipe refresh is refreshing

你好!我有一个 recyclerview 和滑动刷新布局。当我向下滑动并开始刷新时,当我向上滚动时它仍在刷新应用程序崩溃并且日志显示图片中的内容。刷新完成后,一切正常,直到您再次刷新时向上滚动。它说索引超出范围和位置 2。在此先感谢! :)

编辑 1:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/swipe_refresh"
    android:layout_width="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimaryNewsBG"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerview"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

</android.support.v4.widget.SwipeRefreshLayout>

已修复! 问题几乎描述了我遇到的确切问题。查找 indexoutofbounds 没有用,所以我设法找到了问题所在:当它被告知清除列表时发生了,但我从未通知适配器数据已刷新!