Android:如何强制在三星Galaxy S8上显示导航条

时间:2022-07-16 18:54:29

Is is possible to force an app to always show to navigation bar in an Android app? On Samsung Galaxy S8 it is possible for the user to hide the navbar during "runtime" - which cause some unexpected behaviours in the app (if you are interested; I tried to add a setOnSystemUiVisibilityChangeListener and redraw, invalidate, requestLayout and forceLayout on the view with no luck. Restarting the activity is not applicable as the app is a single-activity-app. I've also looked into WindowInsets with no luck there neither.).

是否有可能强制应用程序在安卓应用程序中显示导航栏?在三星Galaxy S8上,用户可以在“运行时”隐藏导航条——这在应用程序中会引起一些意料之外的行为(如果你感兴趣的话;我尝试添加一个setOnSystemUiVisibilityChangeListener,并在视图上重新绘制、无效、请求布局和forceLayout,但没有任何运气。重新启动活动是不适用的,因为该应用程序是一个单独的活动应用程序。我也看了看橱窗,但运气也不好。

Therefor, I just want to avoid the problem by not allowing the user to remove the navbar. All the resources I can find online is for hiding the navbar. Does anybody how any suggestions on how to make it stay?

因此,我只想通过不允许用户删除navbar来避免这个问题。我在网上找到的所有资源都是用来隐藏导航条的。有人有什么建议吗?

1 个解决方案

#1


0  

I am not much sure about Samsung S8, but I had worked on Samsung S7. I had used lean back mode setSystemUiVisibility() and passed these two flags

我对三星S8不是很确定,但我曾在三星S7工作过。我使用了向后倾斜模式setSystemUiVisibility()并传递了这两个标志

1.SYSTEM_UI_FLAG_FULLSCREEN
2.SYSTEM_UI_FLAG_HIDE_NAVIGATION
Also for enabling immersive mode, I had used SYSTEM_UI_FLAG_IMMERSIVE in conjunction.

1。SYSTEM_UI_FLAG_FULLSCREEN 2。SYSTEM_UI_FLAG_HIDE_NAVIGATION也用于启用沉浸模式,我将SYSTEM_UI_FLAG_IMMERSIVE结合使用。

It was referenced from visibility & immersive.

它是由可视性和沉浸性引用的。

Correct me if I am wrong or I didn't understand the question.

如果我错了,或者我不理解这个问题,请纠正我。

#1


0  

I am not much sure about Samsung S8, but I had worked on Samsung S7. I had used lean back mode setSystemUiVisibility() and passed these two flags

我对三星S8不是很确定,但我曾在三星S7工作过。我使用了向后倾斜模式setSystemUiVisibility()并传递了这两个标志

1.SYSTEM_UI_FLAG_FULLSCREEN
2.SYSTEM_UI_FLAG_HIDE_NAVIGATION
Also for enabling immersive mode, I had used SYSTEM_UI_FLAG_IMMERSIVE in conjunction.

1。SYSTEM_UI_FLAG_FULLSCREEN 2。SYSTEM_UI_FLAG_HIDE_NAVIGATION也用于启用沉浸模式,我将SYSTEM_UI_FLAG_IMMERSIVE结合使用。

It was referenced from visibility & immersive.

它是由可视性和沉浸性引用的。

Correct me if I am wrong or I didn't understand the question.

如果我错了,或者我不理解这个问题,请纠正我。