您的位置:首页 > 产品设计 > UI/UE

Android 隐藏 SystemUI 全屏显示

2014-04-18 15:14 302 查看
第一种方法:

       修改:frameworks/base/core/res/res/values/dimens.xml 把下面这些值都修改成0即可,编译验证。

<resources>
// 省略部分
<!-- Height of the status bar -->
<dimen name="status_bar_height">0dip</dimen>
<!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_height">0dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
<dimen name="navigation_bar_height_landscape">0dp</dimen>
<!-- Width of the navigation bar when it is placed vertically on the screen -->
<dimen name="navigation_bar_width">0dp</dimen>
<!-- Height of notification icons in the status bar -->
<dimen name="status_bar_icon_size">0dip</dimen>
<!-- Size of the giant number (unread count) in the notifications -->
<dimen name="status_bar_content_number_size">0sp</dimen>
<!-- Height of the system bar (combined status & navigation); used by
SystemUI internally, not respected by the window manager. -->
//省略部分
</resources>


第二种方法:

        修改frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java

private void addStatusBarWindow() {
final View sb = makeStatusBarView();

final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_NAVIGATION_BAR,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
PixelFormat.OPAQUE);

// We explicitly leave FLAG_HARDWARE_ACCELERATED out of the flags.  The status bar occupies
// very little screen real-estate and is updated fairly frequently.  By using CPU rendering
// for the status bar, we prevent the GPU from having to wake up just to do these small
// updates, which should help keep power consumption down.

lp.gravity = getStatusBarGravity();
lp.setTitle("SystemBar");
lp.packageName = mContext.getPackageName();
// 注释掉下面这行即可隐藏SystemUI,全屏显示
//mWindowManager.addView(sb, lp);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息