WindowManager windowManager = context.getWindowManager();
Display display = windowManager.getDefaultDisplay();
int height = display.getHeight();
Class<?> clazz = null;
Object obj = null;
Field field = null;
int x = 0, sbar = 0;
try {
clazz = Class.forName("com.android.internal.R$dimen");
obj = clazz.newInstance();
field = clazz.getField("status_bar_height");
x = Integer.parseInt(field.get(obj).toString());
sbar = context.getResources().getDimensionPixelSize(x);
return height - sbar;
} catch (Exception e1) {
e1.printStackTrace();
return height;
}
android 获取不含状态栏的屏幕像素大小
最新推荐文章于 2021-04-10 10:08:46 发布