Android的ListView控件刷新单排 [英] Android ListView Refresh Single Row
问题描述
在我得到的数据为的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屋!