Android: how to convert whole ImageView to Bitmap?

前端 未结 6 1853
北荒
北荒 2020-11-28 21:37

I have my application that is displaying images with different ratio, resized inside (centerInside) imageView. What I need is to create bitmap from the ImageView including t

6条回答
  •  悲哀的现实
    2020-11-28 22:07

    try {
            photo.setImageURI(Uri.parse("Location");
            BitmapDrawable drawable = (BitmapDrawable) photo.getDrawable();
            Bitmap bitmap = drawable.getBitmap();
            bitmap = Bitmap.createScaledBitmap(bitmap, 70, 70, true);
            photo.setImageBitmap(bitmap);
    
        } catch (Exception e) {
    
        }
    

提交回复
热议问题