in my app I have created a BottomBar with a scaffold using Jetpack Compose. On newer devices (e.g. Google Pixel 6) there is a black bar at the bottom of the App Switcher. How can I remove this? I want it to be the same color as the BottomBar.
Asked
Active
Viewed 106 times
0
-
check https://stackoverflow.com/questions/65610216/how-to-change-statusbar-color-in-jetpack-compose – Gabriele Mariotti Nov 09 '22 at 19:07
-
@GabrieleMariotti Thanks for your reply. I already took a look at this but it doesn't do what I want. With all options I get from the lib I can't set the bar to the same color as the navigation bar. – Ferris Klingenberg Nov 09 '22 at 19:49
1 Answers
0
You can use the following piece of code in your theme.kt or any other composable function if you would like the change the colour depending on it:
val window = (LocalView.current.context as? Activity)?.window
?: throw Exception("Not in an activity - unable to gte Window reference")
val myColor = Color(0xFFXXXXXX)
SideEffect {
window.statusBarColor = myColor.toArgb()
window.navigationBarColor = myColor.toArgb()
}
There should already be a similar piece of code in your theme.kt file if you have created your project as a Material3 template.

Arthur Kasparian
- 486
- 2
- 12