在onCreate()中无法获得,必须在下面的方法中:

@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;

}

更多相关文章

  1. Android(安卓)ontouch 手速
  2. Android:通过WifiManager监听Wifi信号强弱
  3. Android(安卓)getDecorView用途——屏幕截图
  4. android 之 selector
  5. android中图片倒影、圆角效果重绘
  6. 屏幕切换,保存内容
  7. 2011.07.20——— android 获得当前view在屏幕的坐标
  8. android获得手机的电量
  9. Android(安卓)app实现重启

随机推荐

  1. react native android
  2. 配置flutter --Android license status u
  3. Android 的OpenGL ES与EGL
  4. Android MediaRecorder系统结构
  5. Android中Dialog的使用
  6. Ubuntu Android NDK环境的配置
  7. Android(安卓)OkHttp的Cookie自动化管理
  8. android framework中添加自定义的permiss
  9. Android布局(layout)
  10. Android 中文API (70) —— BluetoothDevic