如何获得附加到的ImageView整个位图? [英] How to get the whole bitmap attached to an ImageView?

查看:162
本文介绍了如何获得附加到的ImageView整个位图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让位图附加到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.

这篇关于如何获得附加到的ImageView整个位图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆