从 Android L 中的 ImageView 获取位图
2022-08-31 19:56:22
我想从.我使用了以下代码,但返回空值。如何从 中获得整体。Bitmap
ImageView
getDrawable()
Bitmap
ImageView
Bitmap bitmap;
if (mImageViewer.getDrawable() instanceof BitmapDrawable) {
bitmap = ((BitmapDrawable) mImageViewer.getDrawable()).getBitmap();
} else {
Drawable d = mImageViewer.getDrawable();
bitmap = Bitmap.createBitmap(d.getIntrinsicWidth(), d.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
d.draw(canvas);
}
storeImage(bitmap,"final.jpeg");