1

我正在使用复杂的ListView. 这是孩子有ImageViews 和TextViews。我正在重写 SimpleCursorAdapter 的 bindView() 方法来为这些小部件设置数据。这是代码:

public void bindView(View view, Context mContext, Cursor cursor) {
        super.bindView(view, mContext, cursor);
        String vdstatus = cursor.getString(6);
        String mbpath = sdpath + propmanager.mbActivePath();
        String vspath = cursor.getString(7);
        TextView status = (TextView) view.findViewById(R.id.status);
        TextView name = (TextView) view.findViewById(R.id.name);
        ImageView i = (ImageView) view.findViewById(R.id.icon);
        if (vdstatus == "false") {
            status.setTextColor(Color.RED);
        } else {
            status.setTextColor(Color.parseColor("#4B8A08"));
        }
        if (mbpath.equals(vspath)) {
            name.setTextColor(Color.RED);
        }
        switch (Integer.parseInt(cursor.getString(4))) {
        case 0: {
            Drawable drawable = mContext.getResources().getDrawable(
                    R.drawable.a2s_icon);
            i.setImageDrawable(drawable);
            break;
        }
        .....
        .....
        .....
        default: {
            Drawable drawable = mContext.getResources().getDrawable(
                    R.drawable.cid);
            i.setImageDrawable(drawable);
            break;
        }
        }
    }

这是我设置适配器的方法:

    MatrixCursor cursor;
    cursor = datasource.getnameList();
    startManagingCursor(cursor);
    String[] from = { "name", "desc", "status", "path", "folder",
            BaseColumns._ID };
    int[] to = { R.id.name, R.id.desc, R.id.status, R.id.path };
    final CustomSCAdapter adapter = new CustomSCAdapter(
            MultiBootManager.this, R.layout.row, cursor, from, to);
    setListAdapter(adapter);

我遇到的问题是滚动浏览ListView真的很生涩。我在这里发现了一些类似的问题,但没有一个答案对我有用。如何防止这种抖动?

4

0 回答 0