繁体   English   中英

如何禁用状态栏而不将其隐藏在 android 中?

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

我想永久禁用状态栏,而不是隐藏它。 我可以通过在 system.prop 中给出qemu.hw.mainkeys=1并构建图像来禁用导航栏。 但是,我没有找到任何禁用状态栏的方法。 我什至尝试使用以下标志 -

View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
View.SYSTEM_UI_FLAG_FULLSCREEN;

但是,这些暂时隐藏了状态和导航栏。 如果用户点击屏幕,它们会弹回。 使用这些标志,它们不会被完全禁用。 网上有很多关于如何隐藏状态和导航栏的解决方案,但没有完全禁用它们。

1)我发现禁用状态和导航栏的唯一方法是禁用 systemui。

pm disable com.android.systemui

但我注意到,禁用 systemui 会禁用很多东西,比如 SD 卡、音量、壁纸等。

2)我尝试的另一种方法是将frameworks/base/core/res/res/values/dimens.xml status_bar_height的 status_bar_height 更改为0dp ,如下所示 -

    <!-- 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>

但是,这导致启动 animation 无法加载,进而不显示屏幕内容(我的 lvds 只是变暗了)。

如何禁用状态栏?

我能够隐藏状态栏的唯一方法是使用此命令

settings set secure user_setup_complete 0

您可以通过将其设置为 1 再次启用它,或者通过使用获取当前状态

settings get secure user_setup_complete

另一个想法可能是使用您现在使用的内容来隐藏它,但在状态栏 java class 的源代码中编辑滑动事件 function

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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