Android SwipeRefreshLayout不允许我向上滚动

Android SwipeRefreshLayout不允许我向上滚动,android,listview,swiperefreshlayout,Android,Listview,Swiperefreshlayout,我有一个带有SwipeRefreshLayout的应用程序,里面有一个ListView。填充ListView时,我可以轻松向下滚动以读取列表中较旧的项目,但当我尝试向上滚动时,此操作被误认为是Pull2Refresh操作,即使我尝试向上滚动。不管我把手指放在哪里,它仍然会把这误认为是Pull2Refresh动作。我如何对这个问题进行排序,因为卷回顶部是一个问题。以下是该片段的XML,带有SwipeRefreshLayout: <android.support.v4.widget.Swipe

我有一个带有
SwipeRefreshLayout
的应用程序,里面有一个
ListView
。填充
ListView
时,我可以轻松向下滚动以读取列表中较旧的项目,但当我尝试向上滚动时,此操作被误认为是Pull2Refresh操作,即使我尝试向上滚动。不管我把手指放在哪里,它仍然会把这误认为是Pull2Refresh动作。我如何对这个问题进行排序,因为卷回顶部是一个问题。

以下是该片段的XML,带有
SwipeRefreshLayout

<android.support.v4.widget.SwipeRefreshLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/swipe_refresh_layout_general"
  android:layout_width="match_parent"
  android:layout_height="wrap_content">

  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.inc.automata.unamupdates.fragments.GeneralNewsFragment">

    <ListView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/listViewGeneral">
    </ListView>
  </FrameLayout>
</android.support.v4.widget.SwipeRefreshLayout>

尝试在listview中使用以下属性

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.inc.automata.unamupdates.fragments.GeneralNewsFragment">

    <ListView
        android:id="@+id/listViewGeneral"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:smoothScrollbar="true"
        android:fadeScrollbars="true"></ListView>

</FrameLayout>



问题在于,您已使用滑动刷新布局包装了整个布局。您应该只使用SwiperFreshLayout包装ListView。



SwipeRefreshLayout内的ListView、FrameLayout内的ListView不起作用?这是否回答了您的问题?
 <android.support.v4.widget.SwipeRefreshLayout
...
>
    <RecyclerView 
     ...
    />
</android.support.v4.widget.SwipeRefreshLayout>