开发者

How to get width and height of the image?

开发者 https://www.devze.com 2023-02-01 08:13 出处:网络
HI, I want to ge开发者_C百科t width and height of the image which i was stored in the drawable folder.

HI,

I want to ge开发者_C百科t width and height of the image which i was stored in the drawable folder. Is this possible, if so please let me know ?


try

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


I have follow this link :-

Drawable d = getResources().getDrawable(R.drawable.yourimage);
int h = d.getIntrinsicHeight();
int w = d.getIntrinsicWidth();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号