在android中拉动刷新
我已经实现了 pull to在我的应用程序中刷新,它在 2.2 中工作正常,但在 2.0 中却不行。
我在 2.0 中找不到方法“smoothScrollBy()”。
谁能给我这个问题的解决方案或任何其他替代方案?如何实现像 iPhone 那样的拉动刷新功能?
谢谢..
Possible Duplicate:
How to implement Android Pull-to-Refresh
I have implemented pull to refresh in my app which works fine in 2.2, but in 2.0 it doesn't.
I couldn't find the method 'smoothScrollBy()' in 2.0.
Can anyone please give me the solution for this issue or any other alternative? How can I acheive pull to refresh functionality like in iphone?
Thanks..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您还可以查看 Johan Nilsson 的 android-pultorefresh 库:
https://github.com/johannilsson/android-pulltorefresh
它提供了一个开箱即用的“拉动刷新”小部件,取代了基本的 Android ListView。
You could also take a look to Johan Nilsson's android-pulltorefresh library:
https://github.com/johannilsson/android-pulltorefresh
It provides an out-of-the-box "pull to refresh" widget that replace the basic Android ListView.
smoothScrollBy
是在 API 版本 8 中引入的,因此在其他版本中不可用。 (您可以在详细 API 的最右侧看到某个方法可用的 API 版本,例如 此处)。我不确定刷新您的应用程序与
smoothScrollBy
有什么关系。如果您有带有适配器的ListView
,则只需更新适配器的内容并调用notifyDataSetChanged()
smoothScrollBy
was introduced in API version 8, so it is not available in other versions. (You can see what API version a method is available in on the far right hand side of the detailed API, like here).I'm not sure what refreshing your app has to do with
smoothScrollBy
though. If you have aListView
with an adapter, you can just update the contents of the adapter and callnotifyDataSetChanged()
我还为 Android 实现了一个强大、开源、易于使用且高度可定制的 PullToRefresh 库。您可以将 ListView 替换为 PullToRefreshListView,如项目页面上的文档中所述。
https://github.com/erikwt/PullToRefresh-ListView
I've also implemented a robust, open source, easy to use and highly customizable PullToRefresh library for Android. You can replace your ListView with the PullToRefreshListView as described in the documentation on the project page.
https://github.com/erikwt/PullToRefresh-ListView