简体   繁体   中英

How to disable status bar and not hide it in android?

I want to permanently disable status bar, not hide it. I was able to disable navigation bar by giving qemu.hw.mainkeys=1 in system.prop and building the image. But, i didn't find any method to disable status bar. I even tried with the below flags -

View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
View.SYSTEM_UI_FLAG_FULLSCREEN;

But, these temporarily hide the status and navigation bar. If the user taps the screen, they pop back up. With these flags, they do not get fully disabled. There are many solutions online on how to hide the status and navigation bar, but not fully disable them.

1) The only method i found to disable status and navigation bar is by disabling systemui.

pm disable com.android.systemui

But i noticed that, disabling systemui, disables a lot of things, like SD card, volume, wallpapers,etc.

2) The other method that i tried is changing status_bar_height in frameworks/base/core/res/res/values/dimens.xml to 0dp as shown below -

    <!-- Height of the status bar -->
    <dimen name="status_bar_height">@dimen/status_bar_height_portrait</dimen>
    <!-- Height of the status bar in portrait -->
    <dimen name="status_bar_height_portrait">0dp</dimen>
    <!-- Height of the status bar in landscape -->
    <dimen name="status_bar_height_landscape">@dimen/status_bar_height_portrait</dimen>

But, this caused the boot animation to not load and in-turn not to display the screen contents (My lvds went just dark).

How do i disable status bar?

The only way I was able to hide the status bar is by using this command

settings set secure user_setup_complete 0

You can enable it again by setting it to 1 or get the current status by using

settings get secure user_setup_complete

Another idea might be to use what you're using now to hide it but edit the swipe event function in source code for the status bar java class to do nothing so the swipe down gets ignored.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM