5

私は例とチュートリアルを精査してきましたが、サブクラス化された SimpleCursorAdapter 内でリサイクルを処理する方法について理解できないようです。通常の ArrayAdapter では、convertView で null をチェックし、null の場合は xml からインフレートし、null でない場合はリサイクルできることを知っていますが、SimpleCursorAdapter サブクラス内の from 配列と to 配列でそれがどのように機能するかを視覚化するのに少し問題があります。Commonsware の The Busy Coders Guide to Android Development からこれを理解しようとしましたが、うまくいきませんでした。誰かがヒント、例、またはチュートリアルを知っている場合は、それらを見て感謝します.

4

5 に答える 5

9

SimpleCursorAdapter をサブクラス化して convertView リサイクル方法論を使用するための良い例を見つけることができなかったため、代わりに CursorAdapter をサブクラス化することになりました。これは実際に私の実装では非常にうまく機能し、メモリ使用量が劇的に減少して非常に高速です。ビューのリサイクルは本当に機能するので、強くお勧めします!

これが私の実装の例です:

 private static class MyNiftyAdapter extends CursorAdapter
    {
        private LayoutInflater mInflater;
        private Cursor cur;

        public MyNiftyAdapter(Context context, Cursor c) {
            super(context,c);       
            this.mInflater = LayoutInflater.from(context);
            this.cur = c;
        }
        public MyNiftyAdapter(Context context, Cursor c, boolean autoRequery)
        {
            super(context, c, autoRequery);
            this.mInflater = LayoutInflater.from(context);
            this.cur = c;
        }
        @Override
        public View getView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder viewHolder;
            if(convertView == null)
            {
                convertView = this.mInflater.inflate(R.layout.chamber_item, null);
                viewHolder = new ViewHolder();
                viewHolder.name = (TextView)convertView.findViewById(R.id.Name);
                viewHolder.city = (TextView)convertView.findViewById(R.id.city);
                viewHolder.state = (TextView)convertView.findViewById(R.id.state);
                viewHolder.country = (TextView)convertView.findViewById(R.id.country);
                convertView.setTag(viewHolder);
            }else
            {
                viewHolder = (ViewHolder)convertView.getTag();
            }
            this.cur.moveToPosition(position);

            viewHolder.name.setText(this.cur.getString(this.cur.getColumnIndex(MyDBHelper.NAME)));          
            viewHolder.city.setText(this.cur.getString(this.cur.getColumnIndex(MyDBHelper.CITY)));
            viewHolder.state.setText(this.cur.getString(this.cur.getColumnIndex(MyDBHelper.STATE)));
            viewHolder.country.setText(this.cur.getString(this.cur.getColumnIndex(MyDBHelper.COUNTRY)));            

            return convertView;
        }
        /* (non-Javadoc)
         * @see android.widget.CursorAdapter#bindView(android.view.View, android.content.Context, android.database.Cursor)
         */
        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            // Dont need to do anything here

        }
        /* (non-Javadoc)
         * @see android.widget.CursorAdapter#newView(android.content.Context, android.database.Cursor, android.view.ViewGroup)
         */
        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent) {
            // Dont need to do anything here either
            return null;
        }

        static class ViewHolder
        {
            TextView name;
            TextView city;
            TextView state;
            TextView country;
        }
    }

リストの各行には、希望どおりに名前、都市、州、国が表示されるようになりました。お役に立てれば。

于 2010-11-10T05:01:53.353 に答える
5

CursorAdapter は部分的に作業を行います。新しいビューを作成する必要がある場合は newView() をオーバーライドするだけでよく、既存のビューを再利用する場合は bindView() をオーバーライドする必要があります。

于 2010-11-05T00:44:48.963 に答える
3

import java.util.ArrayList;

import android.content.Context; import android.database.Cursor; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CursorAdapter; import android.widget.ImageView; import android.widget.TextView;

public class AccountsAdapter extends CursorAdapter {

 public static final String TAG = AccountsAdapter.class.getSimpleName();

 private Boolean DEBUG=true;
 private LayoutInflater mInflater;
 private int layoutResource;
 private Cursor mCursor;
 private int acctInd;
 private int upicInd;
 private  ViewHolder holder;
 public AccountsAdapter(Context context,Cursor c,int resourceId) {
     super(context,c);
     this.mCursor=c;
     acctInd=mCursor.getColumnIndex(LJDB.KEY_JOURNALNAME);
     upicInd=mCursor.getColumnIndex(LJDB.KEY_DEFAULTUSERPIC);

     this.layoutResource=resourceId;
     this.mInflater = LayoutInflater.from(context);
 }


 private static class ViewHolder {
     ImageView userpic;
     TextView journalname;
 }

@Override public void bindView(View view, Context context, Cursor cursor) { holder = (ViewHolder) view.getTag(); holder.journalname.setText(cursor.getString(acctInd)); holder.userpic.setTag(cursor.getString(upicInd));

} @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View v = mInflater.inflate(layoutResource, null); holder = new ViewHolder(); holder.userpic = (ImageView) v.findViewById(R.id.duserpic); holder.journalname = (TextView) v.findViewById(R.id.uname);

v.setTag(holder); return v;

}}

于 2011-01-04T18:13:28.193 に答える
1

ResourceCursorAdapterをサブクラス化することもできます。その場合、bindviewメソッドをオーバーライドするだけで済みます。

public class MySimpleCursorAdapter extends ResourceCursorAdapter {

public MySimpleCursorAdapter(Context context, Cursor c) {
    super(context, R.layout.myLayout, c);
}

@Override
public void bindView(View view, Context context, Cursor cursor) {
    ViewHolder viewHolder = (ViewHolder) view.getTag();
    if (viewHolder == null) {
        viewHolder = new ViewHolder(view);
        view.setTag(viewHolder);
    }
    viewHolder.bind(cursor, context);
}

/**
 * A ViewHolder keeps references to children views to avoid unnecessary calls
 * to findViewById() on each row (especially during scrolling)
 */
private static class ViewHolder {
    private TextView text;

    private ToggleButton toggle;

    public ViewHolder(View view) {
        text = (TextView) view.findViewById(R.id.rowText);
        toggle = (ToggleButton) view.findViewById(R.id.rowToggleButton);
    }

    /**
     * Bind the data from the cursor to the proper views that are hold in
     * this holder
     * @param cursor
     */
    public void bind(Cursor cursor, Context context) {
        toggle.setChecked(0 != cursor.getInt(cursor.getColumnIndex("ENABLED")));
        text.setText(cursor.getString(cursor.getColumnIndex("TEXT")));
    }
}

}

于 2012-02-16T20:00:00.110 に答える
0

私のテストに基づくと、受け入れられた回答は正しくないようです (さらに、不必要です)。

(単純なLog.e出力テストに基づいて)私が知る限り、ビューのリサイクルはデフォルトで正しく処理されます(@Romain Guyが述べたように)。これは、私が遭遇したドキュメントでgetView()をオーバーライドする必要があるという推奨事項がないことを正当化すると思います。

これは、私がこの結論に達するために使用した単純な例で使用されたコード スニペットです。

public class MediaAdapter extends CursorAdapter {

    @Override
    public void bindView(View arg0, Context arg1, Cursor arg2) {
        Log.e("bindView", "Called: " + arg2.getPosition());
        ImageView iv = (ImageView) arg0;
        iv.setImageDrawable(new BitmapDrawable(getResources(), MediaStore.Images.Thumbnails.getThumbnail(arg1.getContentResolver(), 
                arg2.getInt(arg2.getColumnIndex(MediaStore.Images.Media._ID)), MediaStore.Images.Thumbnails.MICRO_KIND, null)));

    }

    @Override
    public View newView(Context arg0, Cursor arg1, ViewGroup arg2) {
        Log.e("newView", "Called: " + arg1.getPosition());
        ImageView iv = new ImageView(ctFrag);
        iv.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, 96));
        iv.setPadding(Spine.getDp(2), Spine.getDp(2), Spine.getDp(2), Spine.getDp(2));

        return iv;
    }

}

これを GridView で使用して、使用可能な画像サムネイルのグリッドを表示すると、LogCat 出力は次のようになりました。

06-11 21:50:09.906: E/newView(3192): Called: 0
06-11 21:50:09.906: E/bindView(3192): Called: 0
06-11 21:50:09.929: E/bindView(3192): Called: 0
06-11 21:50:09.937: E/bindView(3192): Called: 0
06-11 21:50:09.945: E/bindView(3192): Called: 0
06-11 21:50:09.953: E/bindView(3192): Called: 0
06-11 21:50:09.968: E/bindView(3192): Called: 0
06-11 21:50:09.984: E/bindView(3192): Called: 0
06-11 21:50:10.000: D/dalvikvm(3192): GC_CONCURRENT freed 555K, 5% free 14670K/15303K, paused 1ms+6ms
06-11 21:50:10.023: E/bindView(3192): Called: 0
06-11 21:50:10.031: E/bindView(3192): Called: 0
06-11 21:50:10.047: E/newView(3192): Called: 1
06-11 21:50:10.047: E/bindView(3192): Called: 1
06-11 21:50:10.062: E/newView(3192): Called: 2
06-11 21:50:10.062: E/bindView(3192): Called: 2
06-11 21:50:10.070: E/newView(3192): Called: 3
06-11 21:50:10.070: E/bindView(3192): Called: 3
06-11 21:50:10.078: E/newView(3192): Called: 4
06-11 21:50:10.078: E/bindView(3192): Called: 4
06-11 21:50:10.086: E/newView(3192): Called: 5
06-11 21:50:10.086: E/bindView(3192): Called: 5
06-11 21:50:10.093: E/newView(3192): Called: 6
06-11 21:50:10.093: E/bindView(3192): Called: 6
06-11 21:50:10.093: E/newView(3192): Called: 7
06-11 21:50:10.093: E/bindView(3192): Called: 7
06-11 21:50:10.101: E/newView(3192): Called: 8
06-11 21:50:10.101: E/bindView(3192): Called: 8
06-11 21:50:10.101: E/newView(3192): Called: 9
06-11 21:50:10.101: E/bindView(3192): Called: 9
06-11 21:50:10.125: E/newView(3192): Called: 10
06-11 21:50:10.125: E/bindView(3192): Called: 10
06-11 21:50:10.133: E/newView(3192): Called: 11
06-11 21:50:10.133: E/bindView(3192): Called: 11
06-11 21:50:10.140: D/dalvikvm(3192): GC_CONCURRENT freed 351K, 3% free 15001K/15431K, paused 1ms+2ms
06-11 21:50:10.140: E/newView(3192): Called: 12
06-11 21:50:10.140: E/bindView(3192): Called: 12
06-11 21:50:10.164: E/newView(3192): Called: 13
06-11 21:50:10.164: E/bindView(3192): Called: 13
06-11 21:50:10.179: E/newView(3192): Called: 14
06-11 21:50:10.179: E/bindView(3192): Called: 14
06-11 21:50:10.187: E/newView(3192): Called: 15
06-11 21:50:10.187: E/bindView(3192): Called: 15
06-11 21:50:10.195: E/newView(3192): Called: 16
06-11 21:50:10.195: E/bindView(3192): Called: 16
06-11 21:50:10.203: E/newView(3192): Called: 17
06-11 21:50:10.203: E/bindView(3192): Called: 17
06-11 21:50:10.211: E/newView(3192): Called: 18
06-11 21:50:10.211: E/bindView(3192): Called: 18
06-11 21:50:10.218: E/newView(3192): Called: 19
06-11 21:50:10.218: E/bindView(3192): Called: 19
06-11 21:50:10.218: E/newView(3192): Called: 20
06-11 21:50:10.218: E/bindView(3192): Called: 20
06-11 21:50:10.218: E/newView(3192): Called: 21
06-11 21:50:10.218: E/bindView(3192): Called: 21
06-11 21:50:10.226: E/newView(3192): Called: 22
06-11 21:50:10.226: E/bindView(3192): Called: 22
06-11 21:50:10.226: E/newView(3192): Called: 23
06-11 21:50:10.226: E/bindView(3192): Called: 23
06-11 21:50:10.234: E/newView(3192): Called: 24
06-11 21:50:10.234: E/bindView(3192): Called: 24
06-11 21:50:10.234: E/newView(3192): Called: 25
06-11 21:50:10.234: E/bindView(3192): Called: 25
06-11 21:50:10.242: E/newView(3192): Called: 26
06-11 21:50:10.242: E/bindView(3192): Called: 26
06-11 21:50:10.242: E/newView(3192): Called: 27
06-11 21:50:10.242: E/bindView(3192): Called: 27
06-11 21:50:10.250: D/dalvikvm(3192): GC_CONCURRENT freed 247K, 2% free 15582K/15879K, paused 1ms+1ms
06-11 21:50:10.250: E/newView(3192): Called: 28
06-11 21:50:10.250: E/bindView(3192): Called: 28
06-11 21:50:10.265: E/newView(3192): Called: 29
06-11 21:50:10.265: E/bindView(3192): Called: 29
06-11 21:50:10.265: E/newView(3192): Called: 30
06-11 21:50:10.265: E/bindView(3192): Called: 30
06-11 21:50:10.273: E/newView(3192): Called: 31
06-11 21:50:10.273: E/bindView(3192): Called: 31
06-11 21:50:10.273: E/newView(3192): Called: 32
06-11 21:50:10.273: E/bindView(3192): Called: 32
06-11 21:50:10.281: E/newView(3192): Called: 33
06-11 21:50:10.281: E/bindView(3192): Called: 33
06-11 21:50:10.281: E/newView(3192): Called: 34
06-11 21:50:10.281: E/bindView(3192): Called: 34
06-11 21:50:10.289: E/newView(3192): Called: 35
06-11 21:50:10.289: E/bindView(3192): Called: 35
06-11 21:50:10.289: E/newView(3192): Called: 36
06-11 21:50:10.289: E/bindView(3192): Called: 36
06-11 21:50:10.297: E/newView(3192): Called: 37
06-11 21:50:10.297: E/bindView(3192): Called: 37
06-11 21:50:10.297: E/newView(3192): Called: 38
06-11 21:50:10.297: E/bindView(3192): Called: 38
06-11 21:50:10.297: E/newView(3192): Called: 39
06-11 21:50:10.297: E/bindView(3192): Called: 39
06-11 21:50:10.304: E/newView(3192): Called: 40
06-11 21:50:10.304: E/bindView(3192): Called: 40
06-11 21:50:10.304: E/newView(3192): Called: 41
06-11 21:50:10.304: E/bindView(3192): Called: 41
06-11 21:50:10.312: E/newView(3192): Called: 42
06-11 21:50:10.312: E/bindView(3192): Called: 42
06-11 21:50:10.312: E/newView(3192): Called: 43
06-11 21:50:10.312: E/bindView(3192): Called: 43
06-11 21:50:10.320: E/newView(3192): Called: 44
06-11 21:50:10.320: E/bindView(3192): Called: 44
06-11 21:50:10.336: E/newView(3192): Called: 45
06-11 21:50:10.336: E/bindView(3192): Called: 45
06-11 21:50:10.343: E/newView(3192): Called: 46
06-11 21:50:10.343: E/bindView(3192): Called: 46
06-11 21:50:10.351: D/dalvikvm(3192): GC_CONCURRENT freed 301K, 3% free 16297K/16647K, paused 1ms+3ms
06-11 21:50:10.351: E/newView(3192): Called: 47
06-11 21:50:10.351: E/bindView(3192): Called: 47
06-11 21:50:10.351: E/newView(3192): Called: 48
06-11 21:50:10.359: E/bindView(3192): Called: 48
06-11 21:50:10.367: E/newView(3192): Called: 49
06-11 21:50:10.367: E/bindView(3192): Called: 49
06-11 21:50:10.383: E/newView(3192): Called: 50
06-11 21:50:10.383: E/bindView(3192): Called: 50
06-11 21:50:10.390: E/newView(3192): Called: 51
06-11 21:50:10.390: E/bindView(3192): Called: 51
06-11 21:50:10.406: E/newView(3192): Called: 52
06-11 21:50:10.406: E/bindView(3192): Called: 52
06-11 21:50:10.414: E/newView(3192): Called: 53
06-11 21:50:10.414: E/bindView(3192): Called: 53
06-11 21:50:10.422: E/newView(3192): Called: 54
06-11 21:50:10.422: E/bindView(3192): Called: 54
06-11 21:50:10.422: E/newView(3192): Called: 55
06-11 21:50:10.422: E/bindView(3192): Called: 55
06-11 21:50:10.429: E/newView(3192): Called: 56
06-11 21:50:10.429: E/bindView(3192): Called: 56
06-11 21:50:10.437: E/newView(3192): Called: 57
06-11 21:50:10.437: E/bindView(3192): Called: 57
06-11 21:50:10.453: E/newView(3192): Called: 58
06-11 21:50:10.453: E/bindView(3192): Called: 58
06-11 21:50:10.461: E/newView(3192): Called: 59
06-11 21:50:10.461: E/bindView(3192): Called: 59
06-11 21:50:10.468: E/newView(3192): Called: 60
06-11 21:50:10.468: E/bindView(3192): Called: 60
06-11 21:50:10.484: E/newView(3192): Called: 61
06-11 21:50:10.484: E/bindView(3192): Called: 61
06-11 21:50:10.492: E/newView(3192): Called: 62
06-11 21:50:10.492: E/bindView(3192): Called: 62
06-11 21:50:10.508: E/newView(3192): Called: 63
06-11 21:50:10.508: E/bindView(3192): Called: 63
06-11 21:50:10.515: E/newView(3192): Called: 64
06-11 21:50:10.515: E/bindView(3192): Called: 64
06-11 21:50:10.523: E/newView(3192): Called: 65
06-11 21:50:10.523: E/bindView(3192): Called: 65
06-11 21:50:10.539: E/newView(3192): Called: 0
06-11 21:50:10.539: E/bindView(3192): Called: 0
06-11 21:50:10.547: E/bindView(3192): Called: 0
06-11 21:50:10.547: E/bindView(3192): Called: 0
06-11 21:50:10.578: E/bindView(3192): Called: 0
06-11 21:50:10.593: D/dalvikvm(3192): GC_CONCURRENT freed 392K, 3% free 17115K/17543K, paused 2ms+7ms
06-11 21:50:10.601: E/bindView(3192): Called: 0
06-11 21:50:10.609: E/bindView(3192): Called: 0
06-11 21:50:10.625: E/bindView(3192): Called: 0
06-11 21:50:10.633: E/bindView(3192): Called: 0
06-11 21:50:14.586: D/dalvikvm(3192): GC_FOR_ALLOC freed 307K, 4% free 18033K/18695K, paused 14ms
06-11 21:50:14.632: D/dalvikvm(3192): GC_FOR_ALLOC freed 2K, 3% free 19439K/19911K, paused 11ms
06-11 21:50:14.632: E/bindView(3192): Called: 66
06-11 21:50:14.640: E/bindView(3192): Called: 67
06-11 21:50:14.640: E/bindView(3192): Called: 68
06-11 21:50:14.648: E/bindView(3192): Called: 69
06-11 21:50:14.648: E/bindView(3192): Called: 70
06-11 21:50:14.656: E/bindView(3192): Called: 71
06-11 21:50:14.656: E/bindView(3192): Called: 72
06-11 21:50:14.664: E/bindView(3192): Called: 73
06-11 21:50:14.664: E/bindView(3192): Called: 74
06-11 21:50:14.672: E/bindView(3192): Called: 75
06-11 21:50:14.672: E/bindView(3192): Called: 76
06-11 21:50:14.679: E/bindView(3192): Called: 77
06-11 21:50:14.679: E/bindView(3192): Called: 78
06-11 21:50:14.687: E/newView(3192): Called: 79
06-11 21:50:14.687: E/bindView(3192): Called: 79
06-11 21:50:14.687: E/newView(3192): Called: 80
06-11 21:50:14.687: E/bindView(3192): Called: 80
06-11 21:50:14.687: E/newView(3192): Called: 81
06-11 21:50:14.687: E/bindView(3192): Called: 81
06-11 21:50:14.695: E/newView(3192): Called: 82
06-11 21:50:14.695: E/bindView(3192): Called: 82
06-11 21:50:14.695: E/newView(3192): Called: 83
06-11 21:50:14.695: E/bindView(3192): Called: 83
06-11 21:50:14.750: E/bindView(3192): Called: 84
06-11 21:50:14.750: E/bindView(3192): Called: 85
06-11 21:50:14.757: E/bindView(3192): Called: 86
06-11 21:50:14.757: E/bindView(3192): Called: 87
06-11 21:50:14.765: E/bindView(3192): Called: 88
06-11 21:50:14.765: E/bindView(3192): Called: 89
06-11 21:50:14.812: E/bindView(3192): Called: 90
06-11 21:50:14.820: E/bindView(3192): Called: 91
06-11 21:50:14.820: E/bindView(3192): Called: 92
06-11 21:50:14.828: E/bindView(3192): Called: 93
06-11 21:50:14.828: E/bindView(3192): Called: 94
06-11 21:50:14.828: E/bindView(3192): Called: 95
06-11 21:50:14.851: D/dalvikvm(3192): GC_CONCURRENT freed 1350K, 7% free 20078K/21511K, paused 2ms+3ms
06-11 21:50:14.882: E/bindView(3192): Called: 96
06-11 21:50:14.890: E/bindView(3192): Called: 97
06-11 21:50:14.890: E/bindView(3192): Called: 98
06-11 21:50:14.890: E/bindView(3192): Called: 99
06-11 21:50:14.898: E/bindView(3192): Called: 100
06-11 21:50:14.898: E/bindView(3192): Called: 101
06-11 21:50:14.945: E/bindView(3192): Called: 102
06-11 21:50:14.945: E/bindView(3192): Called: 103
06-11 21:50:14.953: E/bindView(3192): Called: 104
06-11 21:50:14.953: E/bindView(3192): Called: 105
06-11 21:50:14.961: E/bindView(3192): Called: 106
06-11 21:50:14.961: E/bindView(3192): Called: 107
06-11 21:50:15.078: E/bindView(3192): Called: 108
06-11 21:50:15.086: E/bindView(3192): Called: 109
06-11 21:50:15.086: E/bindView(3192): Called: 110
06-11 21:50:15.093: E/bindView(3192): Called: 111
06-11 21:50:15.093: E/bindView(3192): Called: 112
06-11 21:50:15.101: E/bindView(3192): Called: 113
06-11 21:50:15.711: E/bindView(3192): Called: 114
06-11 21:50:15.718: E/bindView(3192): Called: 115
06-11 21:50:15.718: E/bindView(3192): Called: 116
06-11 21:50:15.726: E/bindView(3192): Called: 117
06-11 21:50:15.726: E/bindView(3192): Called: 118
06-11 21:50:15.734: E/bindView(3192): Called: 119
06-11 21:50:15.734: E/bindView(3192): Called: 120
06-11 21:50:15.742: E/bindView(3192): Called: 121
06-11 21:50:15.742: E/bindView(3192): Called: 122
06-11 21:50:15.750: E/bindView(3192): Called: 123
06-11 21:50:15.750: E/bindView(3192): Called: 124
06-11 21:50:15.757: E/bindView(3192): Called: 125
06-11 21:50:15.867: E/bindView(3192): Called: 126
06-11 21:50:15.867: E/bindView(3192): Called: 127
06-11 21:50:15.875: E/bindView(3192): Called: 128
06-11 21:50:15.875: E/bindView(3192): Called: 129
06-11 21:50:15.882: E/bindView(3192): Called: 130
06-11 21:50:15.882: E/bindView(3192): Called: 131
06-11 21:50:15.922: E/bindView(3192): Called: 132
06-11 21:50:15.929: E/bindView(3192): Called: 133
06-11 21:50:15.929: E/bindView(3192): Called: 134
06-11 21:50:15.953: E/bindView(3192): Called: 135
06-11 21:50:15.961: E/bindView(3192): Called: 136
06-11 21:50:15.961: E/bindView(3192): Called: 137
06-11 21:50:15.968: D/dalvikvm(3192): GC_CONCURRENT freed 2012K, 10% free 20197K/22215K, paused 2ms+3ms
06-11 21:50:15.968: E/bindView(3192): Called: 138
06-11 21:50:15.976: E/bindView(3192): Called: 139
06-11 21:50:15.984: E/bindView(3192): Called: 140
06-11 21:50:15.984: E/bindView(3192): Called: 141
06-11 21:50:15.992: E/bindView(3192): Called: 142
06-11 21:50:15.992: E/bindView(3192): Called: 143
06-11 21:50:16.039: E/bindView(3192): Called: 144
06-11 21:50:16.039: E/bindView(3192): Called: 145
06-11 21:50:16.047: E/bindView(3192): Called: 146
06-11 21:50:16.047: E/bindView(3192): Called: 147
06-11 21:50:16.054: E/bindView(3192): Called: 148
06-11 21:50:16.054: E/bindView(3192): Called: 149
06-11 21:50:16.062: E/bindView(3192): Called: 150
06-11 21:50:16.062: E/bindView(3192): Called: 151
06-11 21:50:16.062: E/bindView(3192): Called: 152
06-11 21:50:16.070: E/bindView(3192): Called: 153
06-11 21:50:16.070: E/bindView(3192): Called: 154
06-11 21:50:16.070: E/bindView(3192): Called: 155
06-11 21:50:16.117: E/bindView(3192): Called: 156
06-11 21:50:16.117: E/bindView(3192): Called: 157
06-11 21:50:16.125: E/bindView(3192): Called: 158
06-11 21:50:16.125: E/bindView(3192): Called: 159
06-11 21:50:16.125: E/bindView(3192): Called: 160
06-11 21:50:16.132: E/bindView(3192): Called: 161
06-11 21:50:16.172: E/bindView(3192): Called: 162
06-11 21:50:16.172: E/bindView(3192): Called: 163
06-11 21:50:16.179: E/bindView(3192): Called: 164
06-11 21:50:16.179: E/bindView(3192): Called: 165
06-11 21:50:16.187: E/bindView(3192): Called: 166
06-11 21:50:16.187: E/bindView(3192): Called: 167
06-11 21:50:16.328: E/bindView(3192): Called: 168
06-11 21:50:16.336: E/bindView(3192): Called: 169
06-11 21:50:16.336: E/bindView(3192): Called: 170
06-11 21:50:16.343: E/bindView(3192): Called: 171
06-11 21:50:16.343: E/bindView(3192): Called: 172
06-11 21:50:16.351: E/bindView(3192): Called: 173
06-11 21:50:16.461: E/bindView(3192): Called: 174
06-11 21:50:16.468: E/bindView(3192): Called: 175
06-11 21:50:16.492: E/bindView(3192): Called: 176
06-11 21:50:16.492: E/bindView(3192): Called: 177

これは、ビューがnewView()の呼び出しによって作成されると、bindView()がビューの変換を処理してメモリを最適化することを非常に明確に示しているようです。

(途中でnewView()が呼び出される数行は、行全体ではなく行の 2 つの部分を表示するときに新しい行を必要とするGridViewです)。

于 2012-06-11T11:59:56.610 に答える