drawable,视图大小
2017-12-12 本文已影响8人
满船清梦___
-
获取屏幕宽高
Rect r = new Rect();//Rect(0, 60 - 1080, 1920)
h=r.height(); //1860
w=r.width();//1080
view.getWindowVisibleDisplayFrame(r);
int screenHeight = view.getRootView().getHeight();//1920
int screenWidth = view.getRootView().getWidth();//1080 -
获取图片宽高
Drawable drawable = image.getDrawable();
int w = drawable.getIntrinsicWidth();
int h = drawable.getIntrinsicHeight();Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
int height = bitmap.getHeight();
int width = bitmap.getWidth();