how to make status bar color transparent in compose like here:
it has the same color but with a little bit shade.
To change color of Text composable in Android Jetpack Compose, pass a required Color value for the optional color parameter of Text composable.
Step 1: After opening the android studio and creating a new project with an empty activity. Step 2: Navigate to res/values/colors. xml, and add a color that you want to change for the status bar.
Step 1: Locate the MaterialApp widget. Step 2: Inside the MaterialApp, add the theme parameter with ThemeData class assigned. Step 3: Inside the ThemeData add the appBarTheme parameter and then assign the AppBarTheme class. Step 4: Inside the AppBarTheme , specify the systemOverlayStyle parameter and set the color.
Today, we're releasing version 1.2 of Jetpack Compose, Android's modern, native UI toolkit, continuing to build out our roadmap.
Google has just created a library called accompanist
.
You can find it here: https://github.com/google/accompanist
It contains multiple helpful libraries for Jetpack Compose, among which is a System UI Controller that you can use for changing the status bar color.
Docs - https://google.github.io/accompanist/systemuicontroller/
Step 1 (add dependency) => version may change
implementation "com.google.accompanist:accompanist-systemuicontroller:0.17.0"
Step 2 => inside theme.kt file
change the colors according to your need in the functions below.
val systemUiController = rememberSystemUiController() if(darkTheme){ systemUiController.setSystemBarsColor( color = Color.Transparent ) }else{ systemUiController.setSystemBarsColor( color = Color.White ) }
Step 3 => ON systemUiController you can acces all types of customizations u need for you app above one is a sample for setSystemBarsColor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With