我创建了一个带有延迟加载图像的列表视图。图片来自网络。如何获取当前选定的图像位图并将该位图设置为其他图像视图?
我使用了这段代码,但不起作用:
mUuserGallery.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
ListAdapter lList = mUuserGallery.getAdapter();
final View imageView1 = (View)lList.getView(position, view, parent);
final ImageView imageView3 = (ImageView) imageView1.findViewById(R.id.imageIcon);
imageView3.setDrawingCacheEnabled(true);
imageView3.buildDrawingCache();
if (imageView3.getDrawable() instanceof BitmapDrawable) {
b = ((BitmapDrawable) imageView3.getDrawable()).getBitmap();
} else {
Drawable d = imageView3.getDrawable();
b = Bitmap.createBitmap(300, 300, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(b);
d.draw(canvas);
}
mImgViewer = (ImageView)mView.findViewById(R.id.imageView2);
mImgViewer.bringToFront();
mImgViewer.setImageBitmap(b);
}
});