0

CursorAdapter 上的 AlphabetIndexer 明显缓慢/抖动

我的列表视图滚动顺畅,但按住字母索引器滚动条时上下滚动有点紧张

我已经在使用 ViewHolder

我在我的清单上设置了以下内容

mListView.setFastScrollEnabled(true);

我已经按如下方式设置了我的字母索引器

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();
            }

以下内容不适合,因为我已经 在 ListView 中使用了查看器 Android Laggy AlphabetIndexer

4

0 回答 0