如何获得图像的宽度和高度?宽度、如何获得、图像、高度

2023-09-04 23:32:52 作者:低调奢华有内涵的:你的笑〆惊艳了时光

您好,

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

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();
 
精彩推荐