首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

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

2012-10-05 
android获取屏幕长宽,status bar高度,设置全屏显示//获取屏幕长宽WindowManager wm (WindowManager) con

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

热点排行