1.当我上拉或者下拉XlistView的时候 我在上拉下拉方法中启动查询数据的线程。
2.线程查询的数据不为空的时候,给适配器适配数据。
3.适配如下: 传过去两个list 当你一直上拉或者下拉的时候就会报 适配器内容已经改变 但列表视图没收到通知了
if (commentAdapter == null) {
commentAdapter = new CommentAdapter(this, list_comment, list_comment_child);
lv_user_comments.setAdapter(commentAdapter);
lv_user_comments.setPullRefreshEnable(true);
}else{
commentAdapter.notifyDataSetChanged();
lv_user_comments.setPullRefreshEnable(true);
}
2.线程查询的数据不为空的时候,给适配器适配数据。
3.适配如下: 传过去两个list 当你一直上拉或者下拉的时候就会报 适配器内容已经改变 但列表视图没收到通知了
if (commentAdapter == null) {
commentAdapter = new CommentAdapter(this, list_comment, list_comment_child);
lv_user_comments.setAdapter(commentAdapter);
lv_user_comments.setPullRefreshEnable(true);
}else{
commentAdapter.notifyDataSetChanged();
lv_user_comments.setPullRefreshEnable(true);
}
本文介绍了一种使用XListView实现上拉加载更多和下拉刷新的方法。在用户操作XListView时,通过启动线程查询数据,并更新适配器显示最新数据。然而,在频繁操作时可能会遇到适配器已更改但ListView未收到通知的问题。

被折叠的 条评论
为什么被折叠?



