如何在滚动时停止刷新列表视图中的列表项

时间:2015-07-13 10:18:46

标签: listview android-listview listitem

我想在列表视图中停止刷新UI,因为我正在使用Custom Adapter。 在我的列表视图中包含带有进度条的音乐。当我想播放进度条时,它会在向下滚动时返回到进度条重置为初始值,但媒体播放器继续播放。

1 个答案:

答案 0 :(得分:2)

试试这个

//Save where you last were in the list.
int index = mList.getFirstVisiblePosition();
View v = mList.getChildAt(0);
// Call to notify, or updated(change, remove, move, add)

notifyDatasetChanged()
int top = (v == null) ? 0 : v.getTop();

//Prevents the scroll to the new item at the new position
mList.setSelectionFromTop(index, top); 
相关问题