【问题标题】:Android SwipeRefreshLayout on RecyclerView with reverse layout具有反向布局的 RecyclerView 上的 Android SwipeRefreshLayout
【发布时间】: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


    【解决方案1】:

    由于 SwipeRefreshLayout 不支持反向布局,我解决了使用这个库的问题

    Refresh layout bottom

    【讨论】:

    • 这是一个旧实现,不适用于新版本的 SwipeRefreshLayout
    猜你喜欢
    • 1970-01-01
    • 2020-01-16
    • 2020-07-10
    • 2016-07-19
    • 2020-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多