Android 向上滑动刷新 ListView
Android Swipe Up to Refresh ListView
我必须实现 android 向上滑动以刷新列表视图。我从 here 获得了示例代码。但在此代码中,向下滑动以刷新列表视图。我希望它向上滑动以刷新列表视图。如果有人知道答案,请从我一开始就能理解的地方解释或建议我 link。谢谢。
请使用
Link 通过设置方向滚动bottom/Up 的库。
您也可以使用其他 SO 链接
SwipeRefreshLayout - Pull From Bottom
以前我们曾经实现自定义滑动视图来检测向下滑动。但是 android 通过在 android.support.v4 中引入 SwipeRefreshLayout 来检测任何视图上的垂直滑动,让我们的一天变得更轻松。
下面link显示了一步一步的过程
http://www.androidhive.info/2015/05/android-swipe-down-to-refresh-listview-tutorial/
可以使用SwipeRefreshLayout,需要刷新的布局应该在这个布局里面。
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/sw_refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--layout which should be refreshed should come here-->
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
查看完整的实现
我必须实现 android 向上滑动以刷新列表视图。我从 here 获得了示例代码。但在此代码中,向下滑动以刷新列表视图。我希望它向上滑动以刷新列表视图。如果有人知道答案,请从我一开始就能理解的地方解释或建议我 link。谢谢。
请使用
Link 通过设置方向滚动bottom/Up 的库。
您也可以使用其他 SO 链接
SwipeRefreshLayout - Pull From Bottom
以前我们曾经实现自定义滑动视图来检测向下滑动。但是 android 通过在 android.support.v4 中引入 SwipeRefreshLayout 来检测任何视图上的垂直滑动,让我们的一天变得更轻松。
下面link显示了一步一步的过程
http://www.androidhive.info/2015/05/android-swipe-down-to-refresh-listview-tutorial/
可以使用SwipeRefreshLayout,需要刷新的布局应该在这个布局里面。
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/sw_refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--layout which should be refreshed should come here-->
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
查看完整的实现