开发者

Scrolling to Item

开发者 https://www.devze.com 2023-03-27 21:47 出处:网络
I\'m new to Android and I want to know how to scroll down to a position specified by a button in ListView. Say for example I have an array of 5000 items, sorted. I will have 33 letters on to开发者_Pyt

I'm new to Android and I want to know how to scroll down to a position specified by a button in ListView. Say for example I have an array of 5000 items, sorted. I will have 33 letters on to开发者_Python百科p of the screen and user wants to get to position that starts with letter 'M'. How can I make it so that user can get to that position without using fingers to scroll.

I know it is possible in HTML (<li>/<ul> tags) but I would like to know how this can be done in Android ListView.


Do it by using the method smoothScrollToPosition()

You only have to know the index, but that would be no problem in a sorted list.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号