我想永久禁用状态栏,而不是隐藏它。我通过在system.prop中提供system.prop并构建图像来禁用导航栏。但是,我没有找到任何方法来禁用状态栏。我甚至尝试用下面的标志-
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
View.SYSTEM_UI_FLAG_FULLSCREEN;
但是,这些临时隐藏状态和导航栏。如果用户点击屏幕,它们会弹出。使用这些标志,它们不会完全禁用。关于如何隐藏状态和导航栏,有许多在线解决方案,但没有完全禁用它们。
1)我发现禁用状态栏和导航栏的唯一方法是禁用systemui。
pm disable com.android.systemui
但是我注意到,禁用了systemui,禁用了很多东西,比如SD卡、音量、壁纸等等。
2)我尝试过的另一种方法是将0dp
中的status_bar_height
改为frameworks/base/core/res/res/values/dimens.xml
,如下所示-
<!-- 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>
但是,这导致引导动画不加载,也不显示屏幕内容(我的lvds只是变黑了)。
如何禁用状态栏?
发布于 2022-01-29 00:14:49
我能够隐藏状态栏的唯一方法是使用以下命令
settings set secure user_setup_complete 0
通过将其设置为1或通过以下方法获得当前状态,可以再次启用它。
settings get secure user_setup_complete
另一个想法可能是使用您现在正在使用的东西来隐藏它,但是在源代码中为状态栏java类编辑swipe事件函数,这样就可以忽略滑动。
https://stackoverflow.com/questions/70751793
复制相似问题