Android的ListView控件刷新单排 [英] Android ListView Refresh Single Row

查看:137
本文介绍了Android的ListView控件刷新单排的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我得到的数据为的ListView单排,我想要更新的单行。

After I have gotten the data for a single row of a ListView, I want to update that single row.

目前我使用 notifyDataSetChanged(); 但是,使查看的反应很慢。是否有任何其他的解决方案?

Currently I am using notifyDataSetChanged(); but that makes the View react very slowly. Are there any other solutions?

推荐答案

一个选项是直接操纵的ListView。首先检查更新行的指数之间的 getFirstVisiblePosition() getLastVisiblePosition(),这两个给你在适配器是在屏幕上可见的第一和最后一个位置。然后你就可以得到该行查看 getChildAt(INT指数)并改变它。

One option is to manipulate the ListView directly. First check if the index of the updated row is between getFirstVisiblePosition() and getLastVisiblePosition(), these two give you the first and last positions in the adapter that are visible on the screen. Then you can get the row View with getChildAt(int index) and change it.

这篇关于Android的ListView控件刷新单排的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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