views:

84

answers:

2

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?

A: 

There is no default widget for that, you have to build it by yourself.

Konstantin Burov
+4  A: 

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 followint 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.

radek-k
Great answer. This is also "the Android way" so it should be preferred to trying to make it work like the iPhone.
noah
Please consider marking it an accepted answer by clicking the tick to the lef of it ;)
radek-k