废话少说上代码
val controler = WindowCompat.getInsetsController(window, window.decorView)
controler.show(WindowInsetsCompat.Type.systemBars())
WindowCompat.setDecorFitsSystemWindows(window, true)
controler.isAppearanceLightStatusBars = true
window.statusBarColor = Color.WHITE
val controler = WindowCompat.getInsetsController(window, window.decorView)
controler.show(WindowInsetsCompat.Type.systemBars())
WindowCompat.setDecorFitsSystemWindows(window, false)
controler.isAppearanceLightStatusBars = true
window.statusBarColor = Color.TRANSPARENT
val controler = WindowCompat.getInsetsController(window, window.decorView)
controler.hide(WindowInsetsCompat.Type.systemBars())
controler.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
WindowCompat.setDecorFitsSystemWindows(window, false)
window.statusBarColor = Color.TRANSPARENT
window.let {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
it.attributes.layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
it.attributes = it.attributes
}
}