I’m trying to change the status bar color using ac...
# compose
n
I’m trying to change the status bar color using accompanist library, but no success… 😕
Copy code
val systemUiController = rememberSystemUiController()
val useDarkIcons = MaterialTheme.colors.isLight

SideEffect {
    systemUiController.setStatusBarColor(
        color = Color.Red,
        darkIcons = useDarkIcons
    )
}
MyComposable()
cc: @cb
c
What does ‘no success’ mean? What API level?
n
MyComposable
has a
Scaffold
as root element… I’m testing on emulator. API 30
Just to add more details… the
TopBar
of my
Scaffold
is using
Copy code
Modifier
    .statusBarsPadding()
Not sure if it helps…
c
Not really. SystemUiController is a very thin layer on top of the Android APIs, so I’d be surprised if this is a bug in Accompanist
If you can provide a reproducible sample, I’ll take a look
n
Sure… give me 2min
c
Please raise it as an issue on the repo 👍
n
I found the issue 😉 I’m using this in my activity’s theme:
Copy code
<item name="android:windowTranslucentStatus">true</item>
Sorry @cb 😞
👍 1
c
Ah yeah, I could probably add a check for that
n
humm… but I can’t have a translucent for one composable and a colored status bar for a different one… 🤔 I mean…
ScreenA
is using a translucent status bar, but
ScreenB
must have a solid status bar. Is there a way to this?
Maybe I can set the activity flags…
c
If it makes you feel any better. I've set up edge to edge on four separate apps and every time I need to do it, it takes forever. There's always some small little issue that trips me up. Also, I've ended up finding that the window manager api or whatever that is supposed to lay you out under the system bars doesn't work as well as the Insetter library edge to edge helper call.
😩 1
n