When I am scrolling up SwipeRefreshLayout refreshing my app

前端 未结 3 1936
一个人的身影
一个人的身影 2021-01-05 06:29

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

相关标签:
3条回答
  • 2021-01-05 06:39

    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>
    
    0 讨论(0)
  • 2021-01-05 06:46

    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>
    
    0 讨论(0)
  • 2021-01-05 06:57
     //create interface
      public interface YourFragmentInterface {
       void fragmentBecameVisible();
      }
    
     //implements YourFragmentInterface
    
            @Override
            public void fragmentBecameVisible() 
    
            // refresh detail
            }
    
    0 讨论(0)
提交回复
热议问题