[英]How do I hide Android's bottom action bar in Flutter?
I know it can be hidden with the following code.我知道它可以用下面的代码隐藏。
SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]);
But as soon as I tap on the screen, the bottom action bar appears again.但是只要我点击屏幕,底部的操作栏就会再次出现。 How can I solve this?
我该如何解决这个问题? Thank you very much
非常感谢
It's a bug in flutter;这是 flutter 中的错误; Nothing we can do for now:
我们暂时无能为力:
https://github.com/flutter/flutter/issues/62412 https://github.com/flutter/flutter/issues/62412
Solution might be to hide both status bar and navigation bar解决方案可能是隐藏状态栏和导航栏
SystemChrome.setEnabledSystemUIOverlays([])
Although there is no way to hide it directly in Flutter.虽然没有办法直接在Flutter中隐藏。 But you can do this by calling a native Android method, which I've already tried and verified works.
但是您可以通过调用本机 Android 方法来做到这一点,我已经尝试过并验证了该方法。
private fun fullScreenCall() {
if (Build.VERSION.SDK_INT in 12..18) { // lower api
val v: View = this.window.decorView
v.systemUiVisibility = View.GONE
} else if (Build.VERSION.SDK_INT >= 19) {
//for new api versions.
val decorView: View = window.decorView
val uiOptions: Int = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
decorView.systemUiVisibility = uiOptions
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.