简体   繁体   中英

Change just one status bar with Android and Jetpack Compose

I'm working on a project with Android and Jetpack Compose and I want to change the status bar color for just one view and the rest of them keeping with the assigned color.

How can I do this with Jetpack Compose? Is there a way to have more than one color in the status bar?

You can do it following the doc here . You can update the system bar colors like so:

// Remember a SystemUiController
val systemUiController = rememberSystemUiController()
val useDarkIcons = MaterialTheme.colors.isLight

SideEffect {
    // Update all of the system bar colors to be transparent, and use
    // dark icons if we're in light theme
    systemUiController.setSystemBarsColor(
        color = Color.Transparent,
        darkIcons = useDarkIcons
    )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM