Changing the Status Bar Color in Jetpack Compose

Every problem solved is a lesson learned. #AndroidTips #SolvedProblemToday

Jetpack Compose

Changing the status bar color is a common task when designing Android applications. With Jetpack Compose, it’s a simple process that can be done in just a few lines of code. (Only for Material Design 2. If you are using Material Design 3, please check the section below after Material Design 2)

Material Design 2

Changing the Status Bar Color in Jetpack Compose

To change the status bar color in Jetpack Compose, we can use the SystemUiController provided by the androidx.compose.ui.platform package.

First, we need accompanist-systemuicontroller, Add the dependency to your app’s build.gradle file:

dependencies {
    implementation "com.google.accompanist:accompanist-systemuicontroller:x.y.z"
}

Note: Replace x.y.z with the latest version number of accompanist

Visit Now