scroll to the specitied position in listview

/// how to scroll to a position in a listView
int index = mList.getFirstVisiblePosition();
View v = mList.getChildAt(0);
int top = (v == null) ? 0 : v.getTop();

// ...

// restore
mList.setSelectionFromTop(index, top);

你可能感兴趣的:(ListView)