Android dialog全屏

window?.apply {
            setWindowAnimations(R.style.DialogBottomAnimation)
            val visibility = (decorView.systemUiVisibility
                    or View.SYSTEM_UI_FLAG_FULLSCREEN
                    or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
            decorView.systemUiVisibility = visibility
            //刘海屏适配,坑爹
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
                val attr = attributes
                attr.layoutInDisplayCutoutMode =
                    WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
                attributes = attr
            }
        }

你可能感兴趣的:(Android dialog全屏)