How can I get the statusbar height?
Accompanist Insets is now deprecated, and WindowInsets.systemBars.asPaddingValues()
gives me 0 every time...
And Modifier.statusBarsPadding()
does nothing in my layout.
Is there any way to get this height?!?
When i call WindowCompat.setDecorFitsSystemWindows(window, false)
before setContent on Activity i get correct values otherwise it returns 0
@Composable
private fun MyComposable() {
Column {
val paddingValues = WindowInsets.systemBars.asPaddingValues()
Spacer(modifier=Modifier.height(paddingValues.calculateTopPadding()))
Text(text = "Padding values: $paddingValues")
}
}
Result
Without WindowCompat.setDecorFitsSystemWindows(window, false)