Android Swipe布局-从底部拉动
当从底部拖动时,是否有方法使用Android Swipe布局-从底部拉动,android,listview,swiperefreshlayout,Android,Listview,Swiperefreshlayout,当从底部拖动时,是否有方法使用SwipeRefreshLayout刷新ListView 我创建了从顶部拉动,但我也需要从底部拉动。有许多教程介绍如何创建从顶部拉入,但我找不到任何从底部拉入的教程?不,您不能使用SwipeRefreshLayout。您需要实现自己的布局,这并不难 检查这个 还有这个 Android支持库版本21中的SwipeRefreshLayout不支持从底部拖动。 我对SwipeRefreshLayoutBottom进行了修改,它基于原始SwipeRefreshLayout代
SwipeRefreshLayout
刷新ListView
我创建了从顶部拉动,但我也需要从底部拉动。有许多教程介绍如何创建从顶部拉入,但我找不到任何从底部拉入的教程?不,您不能使用SwipeRefreshLayout。您需要实现自己的布局,这并不难 检查这个 还有这个
Android支持库版本21中的SwipeRefreshLayout不支持从底部拖动。 我对SwipeRefreshLayoutBottom进行了修改,它基于原始SwipeRefreshLayout代码。 它完全基于原始Google代码,只需反转坐标,并重写了canChildScrollDown方法的实现。所有修改都标记为TODO 使用这个伟大的图书馆:
因此,您可以从顶部和底部滑动,并支持API 9+。我遇到了同样的问题,我通过组合使用SwiperFreshLayout和列表中的触摸事件解决了这个问题。以下是链接: 库必须是您案例的答案 下面的代码使您的
回收器视图从底部向上拉以刷新:
<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>
可能是因为你找错了东西?你所描述的是一种感谢和感谢。我将您的代码移植到Android Studio 1.2项目,并创建了一个aar库。该项目还包括gradle构建。这是可以在这个答案应该被接受!谢谢你,安德烈,这不应该。提问者正在寻找顶部和底部。此外,如果您将SwipeRefreshLayoutBottom.java文件放在项目中的android.support.v4.widget包中,原始包私有类CircleImageView和MaterialProgressDrawable将可从支持库获得。所以你不必保留这些类的副本。很棒的组件。不过,只有一个问题,旋转箭头动画有时无法正确渲染,箭头也无法显示。如果您确定存在此问题,您可以在repo中创建一个问题。这是一个很酷的布局,但有一些bug。例如:向上拉到底部,然后向上拉到底部,而不抬起手指,或者有时刷新图标看起来很奇怪。