有没有办法使用SwipeRefreshLayout
来刷新ListView
?SwipeRefreshLayout - 从底部拉动
我从顶部创建了拉,但我也需要从底部拉。有许多关于如何从顶部创建拉的教程,但我找不到任何从底部拉的教程?
有没有办法使用SwipeRefreshLayout
来刷新ListView
?SwipeRefreshLayout - 从底部拉动
我从顶部创建了拉,但我也需要从底部拉。有许多关于如何从顶部创建拉的教程,但我找不到任何从底部拉的教程?
不,你不能用SwipeRefreshLayout来做到这一点。你需要实现你自己的布局,这并不困难。
入住这 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
从Android的支持库版本21 SwipeRefreshLayout不从底部支持上拉。 我已经基于原始的SwipeRefreshLayout代码对SwipeRefreshLayoutBottom进行了修改。 它完全基于原始的Google代码,只需反转坐标并重载实现canChildScrollDown方法。所有修改都标记为TODO。
谢谢AndreyICE。我将您的代码移植到Android Studio 1.2项目并创建了一个aar库。该项目还包括Gradle构建。它可在https://github.com/JohannBlake/SwipeRefreshLayoutBottom – AndroidDev
这个答案应该被接受!谢谢AndreyICE – Bernas
它不应该。提问者正在寻找顶部和底部。 – Andy
使用这个伟大的图书馆: OrangeGangsters SwipyRefreshLayout
所以,你既可以从顶部和底部,并支持API刷卡9+。
伟大的组件。但只有一个问题,旋转的箭头动画有时不能正确呈现,而箭头不显示。 –
如果您确定该问题,则可以在回购中创建问题 –
这是很酷的布局,但它有一些错误。例如:拉起来,然后从底部往上拉,不用抬起我的手指,或者有时刷新图标看起来很奇怪。 –
我遇到了同样的问题,我用swipeRefreshLayout和我的列表中的触摸事件的组合解决了它。这里是链接:
图书馆omadahealth/SwipyRefreshLayout必须是你的情况的答案。
以下代码使您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>
也许是因为你正在寻找错误的事情?你所描述的是[**无尽的ListView **](https://www.google.at/?q=endless%20listview#q=endless+listview) –