I have a ListView
with 10 items in it, when i set the 4th item in the ListView as selected then my ListView
gets scrolled and 4th item in the ListView
gets placed at the top of the screen.
I don't want to scroll the ListView
when i call setSelected()
for the list item which is not in the view.
I have also tried to scroll the ListView
programmatically using scrollTo(0, 0);
but it is not working.
An old question, but it may be useful to somebody. You can use setSelectionFromTop. It's rather smart, and you can use it for example like that:
getListView().setSelectionFromTop(selection, getListView().getHeight() / 2);
It begins to scroll only after middle of the list:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With