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

sda*_*bet 4 android-source

我想在我的自定义AOSP图像中隐藏/删除状态栏(即包含时钟,通知等的顶部栏)。

您知道这是否切实可行吗?如何 ?

Bru*_*ier 6

状态栏的布局定义在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>
Run Code Online (Sandbox Code Playgroud)

您可以尝试将heightof 设置com.android.systemui.statusbar.phone.PhoneStatusBarView0dp(由status_bar_heightin 定义frameworks/base/core/res/res/values/dimens.xml)或将其设置visibilitygone

这是指向xda-developers的指南的链接,该指南解释了如何“入侵” SystemUI.apk和framework-res.apk以隐藏状态栏:[GUIDE]隐藏状态栏,并且仍然能够在Jelly Bean上进行扩展。知道要修改哪些资源可能会很有用。