Android获得屏幕高度和状态栏高度
16lz
2021-01-23
@Override
publicvoidonWindowFocusChanged(booleanhasFocus){
//TODOAuto-generatedmethodstub
super.onWindowFocusChanged(hasFocus);
getWindow().findViewById(Window.ID_ANDROID_CONTENT);
Displaydisplay=getWindowManager().getDefaultDisplay();
//屏幕高度
intheight=display.getHeight();
Rectframe=newRect();
getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
//状态栏高度
intstatusBarHeight=frame.top;
}
更多相关文章
- Android getDecorView用途——屏幕截图
- 屏幕切换,保存内容
- 2011.07.20——— android 获得当前view在屏幕的坐标
- android 固定屏幕显示方向
- android屏幕旋转时,Activity不重新调用onCreate的方法
- android – 多屏幕适配相关