收录日期:2019/05/24 23:36:37 时间:2009-07-29 17:54:37 标签:iphone,android

I am porting an iPhone app over to the Android platform. One of the views has a very large list of data and on the iPhone app, there's a scrollbar of sorts on the right hand side that displays the letters of the alphabet and allows the user to quickly scroll through the list this way. I am having trouble finding such functionality in Android. Is there a simple way to implement this?

I think this is implemented through AlphabetIndexer, though I have not tried it personally.

The Android way to do this is to make the list filterable using the keyboard, like a Blackberry. You should do it this way to fit in with the platform experience.

To implement this, you call the setTextFilterEnabled(boolean textFilterEnabled) method on your list view. See example below:

myListView.setTextFilterEnabled(true);

For a complete example, see Hello, ListView.


If you can't use that, then you can use the fast scrolling like seen in the Contacts application. This is not a public API yet, but you can implement it from the Contacts source code at http://android.git.kernel.org/?p=platform/packages/apps/Contacts.git;a=summary.

Right side Alphabet indexer with working sources http://hello-android.blogspot.com/2010/11/sideindex-for-android.html