Go to the top of the jump list to the second position

As the question goes when I do either

listview.smoothScrollToPositionFromTop(position, 0); 

or

 listview.setSelectionFromTop(position, 0); 

The item scrolls to the second position in the list, and not at the topmost position. How to make an element scroll to the top position?

UPDATE

For a little context, the following will work

 listview.smoothScrollToPositionFromTop(position+1, 0); 

But I am creating difficulties for me with a treatise.

+4
source share
1 answer

Use listview.setSelection (int position) instead. You can also add OnScrollListener to your ListView for some additional functionality. I implemented it in my application.

0
source

Source: https://habr.com/ru/post/1501925/


All Articles