创建简单的字母顺序滚动ListView中? [英] Create easy alphabetical scrolling in ListView?

查看:136
本文介绍了创建简单的字母顺序滚动ListView中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待效仿在最新的音乐应用程序,即漂亮的小光标弹出它允许一个滚动超快速的艺术家/专辑/曲目,他们正在寻找的功能:

I'm looking to emulate the functionality in the latest Music app, namely the nice little cursor that pops up which allows one to scroll super fast to the artist/album/track they're looking for:

有没有一种方法,使在Android SDK中一个的ListView 这样的功能?

Is there a method to enable functionality like this in a ListView in the Android SDK?

推荐答案

让您的列表适配器实现 SectionIndexer 。音乐应用程序也使用的<一个href="http://developer.android.com/reference/android/widget/AlphabetIndexer.html">AlphabetIndexer做一些繁重的工作。还可以使用 setFastScrollEnabled(真)实际的ListView 来实现这一点。

Have your list adapter implement SectionIndexer. The music app also makes use of AlphabetIndexer to do some of the heavy lifting. Also use setFastScrollEnabled(true) on the actual ListView to enable this.

修改:如果你不使用的CursorAdapter,您将无法使用AlphabetIndexer。你可以尝试寻找实施<一个href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/widget/AlphabetIndexer.java;h=59b2c2a395f7e737ba142f0d20ce02e08ba35396;hb=HEAD">here并看到它如何努力将适应它的ArrayAdapter工作。

Edit: If you're not using a CursorAdapter, you won't be able to use AlphabetIndexer. You might try looking at the implementation here and seeing how hard it would be to adapt it to work with an ArrayAdapter.

这篇关于创建简单的字母顺序滚动ListView中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆