完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/AlphabetIndexer.html

AlphabetIndexer

public class AlphabetIndexer
extends DataSetObserver implements SectionIndexer

java.lang.Object
android.database.DataSetObserver
android.widget.AlphabetIndexer

A helper class for adapters that implement the SectionIndexer interface. If the items in the adapter are sorted by simple alphabet-based sorting, then this class provides a way to do fast indexing of large lists using binary search. It caches the indices that have been determined through the binary search and also invalidates the cache if changes occur in the cursor.
用于实现SectionIndexer接口的适配器的辅助类。如果适配器中的项是通过简单的字母表顺序排序,则此类提供了使用二分法查找,以快速索引大型列表的方法。它缓存了通过二分法查找确定的索引,并且如果其中的游标发生更改,也会使缓存失效。

如果游标发生了改变,则你的适配器有责任通过调用 setCursor(Cursor)来更新游标。 getPositionForSection(int) 方法对指定部分(字母表)的起始索引进行二分法查找。

摘要

字段

protected CharSequence mAlphabet

The string of characters that make up the indexing sections.
组成索引部分的字符串。

protected int mColumnIndex

The index of the cursor column that this list is sorted on.
被排序的这个列表的游标列的索引。

protected Cursor mDataCursor

Cursor that is used by the adapter of the list view.
由列表视图的适配器使用的游标。

Public构造方法

AlphabetIndexer(Cursor cursor, int sortedColumnIndex, CharSequence alphabet)

Constructs the indexer.
构造AlphabetIndexer。

Public方法

int getPositionForSection(int sectionIndex)

Performs a binary search or cache lookup to find the first row that matches a given section's starting letter.
执行一个二分法查找或在缓存中查找,以查找与指定section的起始字母相匹配的第一行。

int getSectionForPosition(int position)

Returns the section index for a given position in the list by querying the item and comparing it with all items in the section array.
通过查询项并将其与section数组中的所有项进行比较,返回列表中指定位置的section索引。

Object[] getSections()

Returns the section array constructed from the alphabet provided in the constructor.
返回构造函数中所提供的字母表的section数组。

更多相关文章

  1. 【eoeAndroid社区索引】android 条形码的知识汇总
  2. 系出名门 Android 系列文章索引
  3. Tab游标,实现fragment滑动,,游标改变
  4. [android]Android异步处理系列文章索引
  5. 【置顶】用Eclipse开发Android应用程序索引贴
  6. android 塔防游戏汇总 及android 游戏开发索引
  7. Android 程式开发(原创)の目录索引

随机推荐

  1. Android(安卓)spinner 样式及其使用详解
  2. Android官方推荐的集合类
  3. 解决小米手机Android(安卓)Studio安装app
  4. Android使用SharedPreferences实现数据存
  5. android 获取摄像头像素
  6. Android:实现Button点击事件的四种方式
  7. 系统相册分析(GallerPicker)
  8. Android(安卓)xml中配置数组资源,在java中
  9. Android(安卓)之AdapterView与Adapter
  10. Android(安卓)点击空白处,隐藏软键盘