I want to implement transparent status bar in jetpack compose.
I have integrated the Accompanist library for this but it has no transparent effect on status bar.
implementation "com.google.accompanist:accompanist-systemuicontroller:0.18.0"
// Remember a SystemUiController
val systemUiController = rememberSystemUiController()
val useDarkIcons = !isSystemInDarkTheme()
DisposableEffect(systemUiController, useDarkIcons) {
// Update all of the system bar colors to be transparent, and use
// dark icons if we're in light theme
systemUiController.setStatusBarColor(
color = Color.Transparent,
darkIcons = useDarkIcons
)
// setStatusBarColor() and setNavigationBarColor() also exist
onDispose {}
}
Tried this as well, but it has problem with the gesture navigation
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
val insets = WindowCompat.getInsetsController(window, view)
window.statusBarColor = Color.Transparent.toArgb() // choose a status bar color
window.navigationBarColor = Color.Transparent.toArgb() // choose a navigation bar color
insets.isAppearanceLightStatusBars = !useDarkTheme
insets.isAppearanceLightNavigationBars = !useDarkTheme
}
}
Kindly suggest a better solution for the transparent status bar.




Try This
Add the below line to your Theme
after adding this line to the theme set this theme in your activity in which you want to set a transparent status bar
Your activity/container layout you wish to have a transparent status bar needs this property set:
add in activity root layout