android - index for ListView?


Question

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?

1
5
8/26/2010 5:21:09 AM

Accepted Answer

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.

20
10/15/2012 4:17:15 AM


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon