隐藏底部虚拟导航栏

隐藏底部虚拟导航栏

直接用下面这段代码就可以,亲测可用:

if (Build.VERSION.SDK_INT in 12..18) {
        var v = this.window.decorView;[图片上传中...(隐藏前.png-9c59ea-1546411425618-0)]

        v.systemUiVisibility = View.GONE;
    } else if (Build.VERSION.SDK_INT >= 19) {
        var decorView = window.decorView;
        val uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or View.SYSTEM_UI_FLAG_FULLSCREEN
        decorView.systemUiVisibility = uiOptions;
    }···

效果图如下:

隐藏前.png
隐藏后.png

推荐阅读更多精彩内容