问题
Is there a way to use SwipeRefreshLayout
to refresh ListView
when it's pulled from bottom?
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?
回答1:
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.
Bitbucker repository
回答2:
Use this great library: OrangeGangsters SwipyRefreshLayout
So you can swipe both from top and bottom and supports API 9+.
回答3:
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:
https://stackoverflow.com/a/41701320/6144027
回答4:
Library omadahealth/SwipyRefreshLayout must be the answer for your case.
Below Codes make your 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>
回答5:
No, you can't do that with SwipeRefreshLayout. You need to implement your own layout, which is not that hard.
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
来源:https://stackoverflow.com/questions/24867204/swiperefreshlayout-pull-from-bottom