1

In my Activity, I have a FrameLayout inside a SwipeRefreshLayout, like this:

 <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>

I replace the FrameLayout with a Fragment which contains a ListView, like this:

<?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"/>

The problem that when I scroll down, the ListView doesn't scroll. Instead, the Pull to Refresh indicator is launched.

Any ideas? I know I could set a OnScrollListener in the ListView but I cannot access the SwipeRefreshLayout from the Fragment that contains the ListView.

Any ideas? Thanks

Ale
  • 2,282
  • 5
  • 38
  • 67
  • if you are in the activity you could easily access any view that is inside it "even it's inside the fragment" so i suggest to set the onPullRefresh of the swipe layout inside the activity then do what ever you want inside it note that I suggest to use this instead https://github.com/baoyongzhang/android-PullRefreshLayout – Abdulmalek Dery Jul 08 '18 at 21:04
  • 1
    Take a look to this [answer](https://stackoverflow.com/a/35779571/2274847). I hope it solves the problem. – IrApp Jul 09 '18 at 13:16

1 Answers1

0

Add the following parameter -

app:layout_behavior="@string/appbar_scrolling_view_behavior"
Raj
  • 2,997
  • 2
  • 12
  • 30