Android: how to convert whole ImageView to Bitmap?

前端 未结 6 1813
北荒
北荒 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:17

    It works in Kotlin after buildDrawingCache() being deprecated

     // convert imageView to bitmap
    val bitmap = (imageViewId.getDrawable() as BitmapDrawable).getBitmap()
    

提交回复
热议问题