I am created an app that downloaded some data from internet and show them in a list using recyclerView.So I added SwipeRefreshLayout so that when user is at the beginning of
I think you have implemented SwipeRefreshLayout to whole layout itself. This is not the correct way to implement SwipeRefreshLayout. You should wrap SwipeRefreshLayout to just your RecyclerView, instead of whole layout.
Like below:
<android.support.v4.widget.SwipeRefreshLayout
...
>
<RecyclerView
...
/>
</android.support.v4.widget.SwipeRefreshLayout>
Use SwipeRefreshLayout this way.
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/Recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e0e0e0"
android:overScrollMode="never">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.SwipeRefreshLayout>
//create interface
public interface YourFragmentInterface {
void fragmentBecameVisible();
}
//implements YourFragmentInterface
@Override
public void fragmentBecameVisible()
// refresh detail
}