【问题标题】:Android ListView Scroll down forces Pull To RefreshAndroid ListView 向下滚动强制拉动刷新
【发布时间】:2018-12-16 13:40:56
【问题描述】:

在我的Activity 中,我在SwipeRefreshLayout 中有一个FrameLayout,如下所示:

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

        <FrameLayout
            android:id="@+id/filter_list_fragment_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"></FrameLayout>

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

我将FrameLayout 替换为包含ListViewFragment,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<ListView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@android:id/list"
        android:layout_gravity="center_horizontal"
        android:scrollbarStyle="outsideOverlay"
        android:divider="#d3d3d3"
        android:dividerHeight="2dp"
        android:paddingStart="10dp"
        android:paddingEnd="10dp"
        android:background="@android:color/white"
        android:clipToPadding="false"/>

当我向下滚动时,ListView 不滚动的问题。而是启动“拉动刷新”指示器。

有什么想法吗?我知道我可以在ListView 中设置OnScrollListener,但我无法从包含ListViewFragment 访问SwipeRefreshLayout

有什么想法吗?谢谢

【问题讨论】:

  • 如果您在活动中,您可以轻松访问其中的任何视图“即使它在片段内”所以我建议在活动内设置滑动布局的 onPullRefresh 然后做任何你想在里面注意我建议改用这个github.com/baoyongzhang/android-PullRefreshLayout
  • 看看这个answer。我希望它能解决问题。

标签: android listview scroll fragment swiperefreshlayout


【解决方案1】:

添加以下参数-

app:layout_behavior="@string/appbar_scrolling_view_behavior"

【讨论】:

  • ListView?
猜你喜欢
  • 2019-06-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-25
  • 2021-08-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多