Android: how to convert whole ImageView to Bitmap?

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

    You could just use the imageView's image cache. It will render the entire view as it is layed out (scaled,bordered with a background etc) to a new bitmap.

    just make sure it built.

    imageView.buildDrawingCache();
    Bitmap bmap = imageView.getDrawingCache();
    

    there's your bitmap as the screen saw it.

提交回复
热议问题