本文介绍了自定义CursorAdapater的bindView称为77倍......我做了什么了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读this 那里说没有问题,不用担心,但我想我需要一些安慰。

I read this question where it says not to worry about it but I guess I need some reassurance.

我自定义的CursorAdapter的bindView:

My custom CursorAdapter's bindView:

@Override
public void bindView(View view, Context context, Cursor c) {
    // get handles for views in xml
    ImageView imageView = (ImageView)view.findViewById(R.id.add_lvrow_image);
    TextView titleView = (TextView)view.findViewById(R.id.add_lvrow_title);

    // get data from cursor and "massage" if necessary
    String imageUri = c.getString(c.getColumnIndex(CollectionsTable.COL_IMAGEURI));
    String title = c.getString(c.getColumnIndex(CollectionsTable.COL_TITLE));

    // terrible time getting run-time sizes of imageView, hardcode for now
    int XML_WIDTH = 100;
    int XML_HEIGHT = 100;       

    Log.d(TAG, SCOPE + "bindView called: " +count);
    count++;

    // use static util class
    ImageUtils.loadBitmap(context, imageUri, imageView, XML_WIDTH, XML_HEIGHT);

我下面的系列的Andr​​oid教程装载大位图但移动 decodSmapledBitmapFromUri calculateInSmapleSize loadBitmap BitmapWorkerTask AsyncDrawable cancelPotentialWork getBitmapWorkerTask 来的实用程序文件夹。

I'm following the series of Android tutorials for loading large bitmaps but have moved decodSmapledBitmapFromUri, calculateInSmapleSize, loadBitmap, BitmapWorkerTask, AsyncDrawable, cancelPotentialWork, and getBitmapWorkerTask to a utility folder.

...所以我打电话 loadBitmap 和它的链77次为一个ListView当前中有12行(SIX显示屏幕在加载时与只是一个提示7日放映的)。

...so I'm calling loadBitmap and it's chain 77 times for a listview that currently has 12 rows in it (six show on the screen at load time with just a hint of the 7th showing).

所以我不应该担心,这是正常的(此号码呼叫bindView和放大器,触发了所有这些以后的方法)?

So I shouldn't worry, this is okay (this number of calls to bindView & the firing off of all those subsequent methods)?

感谢您的话。

推荐答案

如果你的列表视图XML的android:layout_height不是match_parent将其更改为安卓layout_height =match_parent

If in your listview xml android:layout_height is not "match_parent" change it to android:layout_height="match_parent"

这篇关于自定义CursorAdapater的bindView称为77倍......我做了什么了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 00:29