I want to make my Activity top to the screen, and the StatusBar transparent, so I write this code:
window?.setDecorFitsSystemWindows(true)
window?.statusBarColor = Color.TRANSPARENT
My targetVersion is 30 My appcompat version is 1.3.0
but when I run it , I got Exception like this enter image description here
So, to remove this exception you need to use the compatible version of the window (i.e.
WindowCompat)So replace:
With: