通过结合使用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