如何不调用notifyDataSetChanged()时更新ListView的某一项数据
来源:互联网 发布:合肥网络招聘会 编辑:程序博客网 时间:2024/06/08 19:13
通过结合使用View#getChildAt(int index)和ListView#getFirstVisiblePosition().
示例如下:
public boolean updateListView(int position, int newProgress) {int first = mListView.getFirstVisiblePosition();int last = mListView.getLastVisiblePosition();if(position < first || position > last) { //just update your DataSet //the next time getView is called //the ui is updated automatically return false;}else { View convertView = mListView.getChildAt(position - first); //this is the convertView that you previously returned in getView //just fix it (for example:) ProgressBar bar = (ProgressBar) convertView.findViewById(R.id.progress); bar.setProgress(newProgress); return true;}}
方法取自StackOverFlow:
[1] http://stackoverflow.com/questions/3724874/how-can-i-update-a-single-row-in-a-listview
[2]http://stackoverflow.com/questions/19025841/how-to-update-some-data-in-a-listview-without-using-notifydatasetchanged
0 0
- 如何不调用notifyDataSetChanged()时更新ListView的某一项数据
- 如何只更新listivew的某一项数据而不调用 notifyDataSetChanged
- ListView notifyDataSetChanged不起作用 数据不更新的原因
- ListView局部更新Item,不调用notifyDataSetChanged()方法
- 不使用notifyDataSetChanged更新ListView
- notifyDataSetChanged()数据不更新的问题
- 调用notifyDataSetChanged无法更新ListView
- 调用notifyDataSetChanged无法更新ListView
- 关于ListView中notifyDataSetChanged()刷新数据不更新原因
- 关于ListView中notifyDataSetChanged()刷新数据不更新原因
- 关于ListView中notifyDataSetChanged()刷新数据不更新原因
- 关于ListView中notifyDataSetChanged()刷新数据不更新原因
- 关于ListView中notifyDataSetChanged()刷新数据不更新原因
- 关于ListView中notifyDataSetChanged()刷新数据不更新原因
- ListView中notifyDataSetChanged()刷新数据不更新原因分析
- 关于ListView中notifyDataSetChanged()刷新数据不更新原因
- android listview notifyDataSetChanged更新数据
- ListView notifyDataSetChanged()不刷新数据
- Linux-Load Average解析
- 转载:Nginx反向代理,负载均衡,redis session共享,keepalived高可用
- 数字格式设置为小数点后两位怎么设置
- React Native 一:开发环境搭建 填坑
- 深入理解计算机系统(原书第三版)中文高清.pdf
- 如何不调用notifyDataSetChanged()时更新ListView的某一项数据
- 【LeetCode】18. 4Sum
- 深入浅出再谈Unity内存泄漏
- c++实验6【项目2:数组合并】
- Spark2.1.0文档:Spark Streaming 编程指南(下)-性能调优和容错语义
- 神经网络实现手写数字识别(MNIST)
- JSF受管Bean
- 文件系统的常用命令
- 2017/5/10笔记