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

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

热度:17   发布时间:2016-05-01 14:20:39.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 codethis.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,    WindowManager.LayoutParams.FLAG_FULLSCREEN); 
  相关解决方案