如何获得图像的宽度和高度? [英] How to get width and height of the image?

查看:136
本文介绍了如何获得图像的宽度和高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我想要得到的宽度,我被存储在绘制文件夹中的图片和高度。 这是可能的,如果是的话,请让我知道?

I want to get width and height of the image which i was stored in the drawable folder. Is this possible, if so please let me know ?

推荐答案

尝试

BitmapDrawable bd=(BitmapDrawable) this.getResources().getDrawable(R.drawable.icon);
int height=bd.getBitmap().getHeight();
int width=bd.getBitmap().getWidth();

这篇关于如何获得图像的宽度和高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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