如何获得附加到的ImageView整个位图?位图、如何获得、ImageView

2023-09-05 03:44:33 作者:一米阳光暖三寸

我试图让位图附加到ImageView的,使用 ImageView.getDrawingCache(); 但是我发现,返回的位图是不一样的,我想从ImageView的获得。它总是比实际图像更小。

I tried to get Bitmap attached to an ImageView, using ImageView.getDrawingCache(); But I found that the returned Bitmap was not the same as I'd like to get from the ImageView. It was always smaller than the real image.

我早知道,该方法 getDrawingCache()不应该认为,如果它是大于屏幕视图的可见部分只画和只有缓存保存什么画。

I had known that, the method getDrawingCache() should not have the view if it is bigger than the screen as the visible portion of the view is only drawn and the cache holds only what is drawn.

我能得到连接到ImageView的整个位图?

Could I get the whole bitmap attached to a ImageView?

推荐答案

如果你只是想在位图的ImageView 以下code可以为你工作: -

If you just want the Bitmap from a ImageView the following code may work for you:-

Bitmap bm=((BitmapDrawable)imageView.getDrawable()).getBitmap();

我想这就是你想要的。

I think that's what you wanted.