1. 程式人生 > >[Android6.0][RK3399] 隱藏導航欄或狀態列

[Android6.0][RK3399] 隱藏導航欄或狀態列

Platform: RK3399
OS: Android 6.0
Version: v2017.02

什麼是導航欄與狀態列

最上面是狀態列 StatusBar
最下面是導航欄 NavagationBar

一、隱藏導航欄

方法一,修改資原始檔程式碼

frameworks/base/core/res/res/values/dimens.xml

<dimen name="navigation_bar_height">48dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
<dimen name="navigation_bar_height_landscape">48dp</dimen> <!-- Width of the navigation bar when it is placed vertically on the screen -->

將高度 48 改成 0

方法二,通過系統 property 來控制

路徑 device/rockchip/rk3399/system.prop

qemu.hw.mainkeys=1

程式碼呼叫
rk3399/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java

mHasNavigationBar = res.getBoolean(com.android.internal.R.bool.config_showNavigationBar);
// Allow a system property to override this. Used by the emulator.
// See also hasNavigationBar().
String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");
if ("1".equals(navBarOverride)) {
    mHasNavigationBar = false
; } else if ("0".equals(navBarOverride)) { mHasNavigationBar = true; }

二、隱藏狀態列

修改資原始檔程式碼

frameworks/base/core/res/res/values/dimens.xml

<dimen name="status_bar_height">24dp</dimen>
<!-- Height of the bottom navigation / system bar. -->

將高度 24 改成 0