开发者

android - index for ListView?

开发者 https://www.devze.com 2023-01-12 13:57 出处:网络
Is it possible to have an index on the righthand side of a ListView?This is possible on the iPhone where running down the righthand side the alphabet is shown.Touching a letter on the alphabet brings

Is it possible to have an index on the righthand side of a ListView? This is possible on the iPhone where running down the righthand side the alphabet is shown. Touching a letter on the alphabet brings one to the beginning of the items in the ListView that start with that letter.

Is there built-in code in Android for this functionality? Or is this something one would have to custom开发者_运维百科 make?


There is no exactly what you want. There is a very similar thing. First set fast scroll mode of your ListView:

ListView.setFastScrollEnabled(true);

next implement the following Interface by your adapter:

android.widget.SectionIndexer

http://developer.android.com/reference/android/widget/SectionIndexer.html

This way you will be able to scroll fast your ListView with a thumb button.

If you implement SectionIndexer correctly you will be able to see a alphabet letter on which you are currently on during fast scrolling.


Check this one http://hello-android.blogspot.com/2010/11/sideindex-for-android.html .. exactly the same..

0

精彩评论

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