Listview滚动冻结

时间:2012-10-29 17:09:25

标签: android android-layout android-cursoradapter android-scroll

我有自定义cursoradapter的listview。它包含几百个项目。向下滚动是平滑而快速的,但滚动备份一直在冻结。我不在UI线程上加载图像或一些操作。只从光标中获取少量值并将其设置为textviews

private class EpisodesAdapter extends CursorAdapter {
        LayoutInflater inflater;
        public EpisodesAdapter(Context context) {
            super(context, null, false);
            inflater = (LayoutInflater)     context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        }

        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent) {

            View view = inflater.inflate(R.layout.list_item_episode, parent,  false);

            view.setBackgroundResource(R.drawable.abs__list_selector_holo_light);
            return view;
        }

        @Override
        public void bindView(View view, final Context context, final Cursor cursor) {
            final String title = cursor.getString(EpisodesQuery.EPISODE_TITLE);
            final String episodeId = cursor.getString(EpisodesQuery.EPISODE_ID);
            final String time = cursor.getString(EpisodesQuery.EPISODE_PUBLISHED_AT);
            final String episodeUrl = cursor.getString(EpisodesQuery.EPISODE_URL);
            final int stateId = cursor.getInt(EpisodesQuery.EPISODE_STATE_ID);

                        ((TextView) view.findViewById(R.id.title)).setText(title);
                        ...... 
                }
}

有什么想法会导致这个问题?

2 个答案:

答案 0 :(得分:1)

我想我明白了。游标中的一列包含一些blob数据。当我从查询选择中删除此列时,它会顺利向上滚动。谢谢你的所有答案。

答案 1 :(得分:0)

ListView empty if SimpleCursorAdapter closed()。此链接可能会回答关闭光标的位置。如果它顺利向下滚动,我看到滚动时没有理由冻结。我很好奇你面临的问题。