【发布时间】:2016-07-15 06:37:34
【问题描述】:
每次我尝试在顶部滚动时,我在 swipeRefresh 中有一个回收器视图,会调用 swipe to refresh 方法并刷新布局,但我只想在滚动到屏幕顶部时刷新布局。有没有人回答这个问题。
感谢您的帮助,谢谢
我的布局如下图。
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/rel"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:scrollbars="vertical" />
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>
【问题讨论】:
-
为什么
RecyclerView和SwipeRefreshLayout之间有一个RelativeLayout?SwipeRefreshLayout不应该是RecyclerView的直接父级吗?见developer.android.com/training/swipe/add-swipe-interface.html
标签: android android-recyclerview swiperefreshlayout