当前位置: 代码迷 >> Android >> android获取银幕长宽,status bar高度,设置全屏显示
  详细解决方案

android获取银幕长宽,status bar高度,设置全屏显示

热度:23   发布时间:2016-05-01 17:26:18.0
android获取屏幕长宽,status bar高度,设置全屏显示
//获取屏幕长宽   WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);   wm.getDefaultDisplay().getHeight();   wm.getDefaultDisplay().getWidth();     //获取status bar高度   View rootView  = view.getRootView();   Rect r = new Rect();   rootView.getWindowVisibleDisplayFrame(r);   return r.top;       //设置全屏   //xml   <style name="style_Fullscreen">         <item name="android:windowFullscreen">true</item>         <item name="android:windowNoTitle">true</item>   </style>     //java code   this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,       WindowManager.LayoutParams.FLAG_FULLSCREEN);   

?

  相关解决方案