CursorAdapter上显然缓慢/抖动的AlphabetIndexer
我的列表视图滚动顺畅但按住alphabetindexer滚动条时上下滚动有点紧张
我已经在使用ViewHolder
了我在列表中设置了以下内容
mListView.setFastScrollEnabled(true);
我设置了我的alphabetindexer如下
public class FeedFragmentAdapter extends CursorAdapter implements SectionIndexer {
AlphabetIndexer mAlphabetIndexer;
public FeedFragmentAdapter(Context context, Cursor cursor, int flags) {
super(context, cursor, flags);
cursorInflater = (LayoutInflater) context.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
this.context = context;
}
public void setIndexer(Cursor cursor){
mAlphabetIndexer = new AlphabetIndexer(cursor,
cursor.getColumnIndex("name_format"),
"ABCDEFGHIJKLMNOPQRTSUVWXYZ");
mAlphabetIndexer.setCursor(cursor);//Sets a new cursor as the data set and resets the cache of indices.
}
/**
* Performs a binary search or cache lookup to find the first row that matches a given section's starting letter.
*/
@Override
public int getPositionForSection(int sectionIndex)
{
return mAlphabetIndexer.getPositionForSection(sectionIndex);
}
/**
* 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.
*/
@Override
public int getSectionForPosition(int position)
{
return mAlphabetIndexer.getSectionForPosition(position);
}
/**
* Returns the section array constructed from the alphabet provided in the constructor.
*/
@Override
public Object[] getSections()
{
return mAlphabetIndexer.getSections();
}
以下不适合,因为我已经在使用视图 Android Laggy AlphabetIndexer in ListView