I'd like to hide/remove the status bar (i.e the top bar containing clock, notifications,...) in my custom AOSP image.
Do you know if it's practically possible ? And how ?
View decorView = getWindow(). getDecorView(); // Hide the status bar.
To hide status bar in Android using Kotlin, we can request that the visibility of the status bar or other screen/window decorations be changed by setting window. decorView. systemUiVisibility with View. SYSTEM_UI_FLAG_FULLSCREEN in the Activity Kotlin file.
The status bar layout is defined in 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>
You could try to set the height
of com.android.systemui.statusbar.phone.PhoneStatusBarView
to 0dp
(defined by status_bar_height
in frameworks/base/core/res/res/values/dimens.xml
) or its visibility
to gone
.
Here is a link to a guide on xda-developers that explains how to "hack" SystemUI.apk and framework-res.apk to hide the status bar: [GUIDE] Hide Status Bar and still being able to expand it on Jelly Bean. It may be useful to know which resources to modify.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With