如何在滚动时停止列表视图中的清单列表项目
问题描述:
我想停止刷新列表视图中的UI,因为我使用的是Custom Adapter
。在我的列表视图中包含 包含带进度条的音乐。当我想播放进度条时,它会在向下滚动时开始回到进度条重置为初始状态,但媒体播放器继续播放。如何在滚动时停止列表视图中的清单列表项目
答
试试这个
//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);
没有用我想这不工作 – Jack