Morgan
05/11/2023, 3:14 PMComposeView
as the root view of my Fragments.
However, the Activity hosting all Fragments does not call WindowCompat.setDecorFitsSystemWindows(window, false)
and thus I have a problem inside the ComposeView
hosted in my Fragments -> insets are not taken into account.
When calling WindowInsets.statusBars.asPaddingValues()
it returns 0.
However, I want my TopAppBar
to have some padding to be below the Android status bar.
I know we're more and more migrating to Compose progressively, someone might eventually have encountered this problem with the insets.
Thank you in advance!galex
05/11/2023, 3:18 PM@Composable
fun EdgeToEdge(
backgroundColor: Color,
content: @Composable BoxScope.() -> Unit,
) {
Box(
modifier = Modifier
.background(backgroundColor)
.fillMaxSize()
.statusBarsPadding()
.navigationBarsPadding(),
content = content
)
}
Hope this helps šMorgan
05/11/2023, 3:26 PMTopAppBar
like this:
TopAppBar(modifier = Modifier.statusBarsPadding())
But does not seem to work š
My AppBar is under the status bar which is kinda ugly and the buttons on it are inaccessible