Android SwipeRefreshLayout - 从底部拉

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24867204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:52:40  来源:igfitidea点击:

SwipeRefreshLayout - Pull From Bottom

androidlistviewswiperefreshlayout

提问by user3486440

Is there a way to use SwipeRefreshLayoutto refresh ListViewwhen it's pulled from bottom?

当它从底部拉出时,有没有办法用来SwipeRefreshLayout刷新ListView

I created pull from top, but I would also need pull from bottom. There are many tutorials on how to create pull from top, but I couldn't find any tutorials for pull from bottom?

我创建了从顶部拉动,但我也需要从底部拉动。有很多关于如何从顶部创建拉动的教程,但我找不到任何从底部拉动的教程?

回答by AndreyICE

SwipeRefreshLayout from Android Support Library version 21 does not support pull from bottom. I have made modification SwipeRefreshLayoutBottom with is based on original SwipeRefreshLayout code. It is fully based on original Google code with just inversion of coordinates and overridden implementation of canChildScrollDown method. All modification are marked as TODO.

Android 支持库版本 21 中的 SwipeRefreshLayout 不支持从底部拉取。我根据原始 SwipeRefreshLayout 代码对 SwipeRefreshLayoutBottom 进行了修改。它完全基于原始 Google 代码,只是坐标反转和 canChildScrollDown 方法的重写实现。所有修改都标记为 TODO。

Bitbucker repository

Bitbucker 存储库

回答by Morteza Rastgoo

Use this great library: OrangeGangsters SwipyRefreshLayout

使用这个很棒的库: OrangeGangsters SwipyRefreshLayout

So you can swipe both from top and bottom and supports API 9+.

因此您可以从顶部和底部滑动并支持 API 9+。

回答by Huy Tower

Library omadahealth/SwipyRefreshLayoutmust be the answer for your case.

图书馆omadahealth/SwipyRefreshLayout必须是您案例的答案。

Below Codes make your Recycler view pull up from bottom to refresh:

下面的代码使您的Recycler view pull up from bottom to refresh

<com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/refresh_layout"
    style="@style/View_MatchParent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    app:srl_direction="bottom"
    >

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerview"
        style="@style/View_MatchParent"
        android:layout_height="wrap_content"
        android:clipToPadding="true"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

</com.omadahealth.github.swipyrefreshlayout.library.SwipyRefreshLayout>

回答by Marie Amida

I've encountered the same problem and I have solved it with a combination of swipeRefreshLayout and a touch event in my list. Here is the link:

我遇到了同样的问题,我已经在我的列表中结合使用 swipeRefreshLayout 和触摸事件来解决它。链接在这里:

https://stackoverflow.com/a/41701320/6144027

https://stackoverflow.com/a/41701320/6144027

回答by ig343

No, you can't do that with SwipeRefreshLayout. You need to implement your own layout, which is not that hard.

不,你不能用 SwipeRefreshLayout 做到这一点。您需要实现自己的布局,这并不难。

Check this http://erikw.eu/open-source-android-pull-to-refresh-library/and this http://www.oodlestechnologies.com/blogs/Implementing-Pull-to-refresh-(like-in-Facebook-mobile-app)-for-ANDROID-using-Titanium

检查这个 http://erikw.eu/open-source-android-pull-to-refresh-library/和这个 http://www.oodlestechnologies.com/blogs/Implementing-Pull-to-refresh-(like-in -Facebook-mobile-app)-for-ANDROID-using-Titanium