如何在 AOSP 构建中隐藏状态栏

How to hide status bar in AOSP build

我想 hide/remove 我的自定义 AOSP 图像中的状态栏(即包含时钟、通知等的顶部栏)。

你知道这是否可行吗?以及如何?

状态栏布局定义在frameworks/base/packages/SystemUI/res/layout/status_bar.xml:

<com.android.systemui.statusbar.phone.PhoneStatusBarView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
    android:layout_width="match_parent"
    android:layout_height="@dimen/status_bar_height"
    android:id="@+id/status_bar"
    android:background="@drawable/system_bar_background"
    android:orientation="vertical"
    android:focusable="false"
    android:descendantFocusability="afterDescendants"
    >

    <!-- […] -->

</com.android.systemui.statusbar.phone.PhoneStatusBarView>

您可以尝试将 com.android.systemui.statusbar.phone.PhoneStatusBarViewheight 设置为 0dp(由 frameworks/base/core/res/res/values/dimens.xml 中的 status_bar_height 定义)或其 visibilitygone.

这是一个 link xda-developers 指南,它解释了如何 "hack" SystemUI.apk 和 framework-res.apk 隐藏状态栏:[GUIDE] Hide Status Bar and still being able to expand it on Jelly Bean。 了解要修改哪些资源可能很有用。