【发布时间】:2015-10-11 18:06:45
【问题描述】:
我在 Android 的 SwipeRefreshLayout 中使用 RecyclerView。
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/mySwipeRefresh"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<RecyclerView
android:id="@+id/myRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
在这个 RecyclerView 中,我使用的是具有反向布局和从末端堆栈的 LinearLayoutManager:
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
layoutManager.setReverseLayout(true);
layoutManager.setStackFromEnd(true);
myRecyclerView.setLayoutManager(layoutManager);
因此,滚动内容从底部开始,并且由适配器从底部添加到顶部。
使用此配置,我想在 RecyclerView 位于底部并且用户尝试向下滚动更多时显示 SwipeRefreshLayout。相反,结果是 SwipeRefreshLayout 具有标准行为,并且当用户滚动到顶部并且 RecyclerView 位于顶部时,会显示从上到下的动画。
我没有找到执行此操作的 api,我该如何解决此问题?
谢谢
【问题讨论】:
标签: android android-recyclerview swiperefreshlayout