如何实现机器人拉来刷新 [英] How to implement Android Pull-to-Refresh

查看:206
本文介绍了如何实现机器人拉来刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android应用程序,如Twitter(官方应用程序),当你遇到一个ListView的时候,你可以拉下来(而且它还会弹回来时发布)刷新内容。

In Android applications such as Twitter (official app), when you encounter a ListView, you can pull it down (and it will bounce back when released) to refresh the content.

我不知道什么是最好的方式,在您看来,实施了吗?

I wonder what is the best way, in your opinion, to implement that?

一些可能性我能想到的:

Some possibilities I could think of:

  1. 在ListView控件的顶部的项目 - 但我不认为与动画的ListView的滚动返回到项目位置1(0型)是一件容易的事
  2. 在ListView外另一种观点 - 但我需要移动的ListView位置向下时,它拉的关怀,我不知道,如果我们可以检测,如果拖动触摸到ListView还真上滚动的物品ListView控件。

任何建议?

P.S。我不知道,当官方Twitter的应用程序源$ C ​​$ C被释放。前面已经讲过,它会被释放,除了6几个月过去了,我们还没有听说这件事至今。

P.S. I wonder when the official Twitter app source code is released. It has been mentioned that it will be released, but 6 months has passed and we haven't heard about it since then.

推荐答案

最后,谷歌发布了拉来刷新库的正式版!

Finally, Google released an official version of pull-to-refresh library!

这就是所谓SwipeRefreshLayout,支持库中,并且该文档是在这里:

It is called SwipeRefreshLayout, inside the support library, and the documentation is here:

<一个href="https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html">https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html

这篇关于如何实现机器人拉来刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆