How to set status bar color to the same color than the app bar color?

580 Views Asked by At

I'm new to Android development. I use jetpack compose. The TopAppBar color elevates as you scroll. That's fine, but I also want to elevate the status bar at the same time to the same color. For example, Google clock app has the feature I want to achieve.

What I have tried:

Setting the status bar color to transparent:

val systemUiController = rememberSystemUiController()
systemUiController.setStatusBarColor(color = Color.Transparent)

Displaying content behind the status Bar

window.setFlags(
    WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
    WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
)
0

There are 0 best solutions below