Krishnan V S
Krishnan V S

Reputation: 1166

Listview - How do I do a smooth scroll to top from the 10th item?

I have the 10th item as the top visible one in the listview. I need to do smooth scroll to the top item. When I do the following, it just stays at around the 6th item from top, does not scroll to the top.

lstConvList.setSelectionFromTop(10, 30);
lstConvList.smoothScrollToPositionFromTop(0, 0, MyMessage.SCROLL_UP_DURATION);

Upvotes: 2

Views: 1568

Answers (1)

archived
archived

Reputation: 647

See this answer.

Quote:

First call smothScrollToPositionFromTop(position) and then, when scrolling has finished, call setSelection(position). The latter call corrects the incomplete scrolling by jumping directly to the desired position. Doing so the user still has the impression that it is being animation-scrolled to this position.

Upvotes: 3

Related Questions