As the question says, when I do either
listview.smoothScrollToPositionFromTop(position, 0);
or
listview.setSelectionFromTop(position, 0);
The item is scrolled to the second position in the list as opposed to the very top position. How do I get the item to scroll to the top position?
UPDATE
For a bit of context, the following would work
listview.smoothScrollToPositionFromTop(position+1, 0);
But I that would create tractability problems for me.
Use listview.setSelection(int position) instead. Also you can add OnScrollListener to your ListView for some more functionality. I have implemented it in my application.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.