How can I programmatically scroll to a specific position in a ListView
?
For example, I have a String[] {A,B,C,D....}
, and I need to set the top visible item of the ListView
to the index 21 of my String[]
.
For a direct scroll:
getListView().setSelection(21);
For a smooth scroll:
getListView().smoothScrollToPosition(21);