【问题标题】:Android simultaneously use Pull to Refresh ListView at the top and automatically Load more data when scroll to the BottomAndroid 同时使用 Pull 刷新顶部的 ListView 并在滚动到底部时自动加载更多数据
【发布时间】:2014-08-08 06:44:07
【问题描述】:
在将其标记为重复之前,请仔细阅读。我正在使用 pulltorefresh
来自this library,我正在使用以下代码在屏幕顶部执行 pulltorefresh:
listView.setMode(Mode.PULL_FROM_START);
现在我还想在滚动到屏幕底部时自动使用 ListView 加载更多数据。是否可以使用 pulltorefresh 库?如果不是请帮我解决这个问题。
提前致谢。
【问题讨论】:
标签:
android
listview
pull-to-refresh
【解决方案1】:
将OnScrollListener 监听器设置为您的ListView。根据显示的项目数量,从网络(异步)获取新行并将它们添加到 ArrayList(或您用于填充列表的任何内容)并调用 notifyDataSetChanged()。