1
在图库的getView方法中, 我已下载位图并设置为Imageview并将其返回给框架。 何时何地应该回收位图? 我不想唤醒系统垃圾回收器来清理位图。如何从Android Gallery回收位图:: GetView方法
public View getView(int position, View view, ViewGroup parent) {
ImageView i = new ImageView(mContext);
downloadFromWeb("www.blahblah.com", i);
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setLayoutParams(new Gallery.LayoutParams(mDisplayWidth, (mDisplayHeight-100)));
i.setBackgroundResource(mGalleryItemBackground);
return i;
}
public downloadFromWeb(URL url, ImageView i){
Bitmap bitmap = getBitmapFromWeb(url);
i.setImageBitmap(bitmap);
}
为了获得名声,并让别人来回答你的问题,投票,并接受您的问题 – 2011-02-21 18:45:47