androidkotlinandroid-jetpack-composestatusbarandroid-15

How to fix status bar icons being invisible in app starting from Android 15


The status bar in my app until Android 14 had a gray (default) background so the icons were always visible. Starting from Android 15, the status bar is now transparent and uses edge-to-edge, and the icons became virtually invisible. This is because my app's background is white (by default) and the icons are also white and didn't automatically adjust. In dark mode, the icons are visible.

I am using Jetpack Compose. I haven't edited anything relating to the status bar or notification icons.

Here are some screenshots:
Status bar in light mode
Status bar in dark mode

Theme.kt:

private val DarkColorScheme = darkColorScheme(
    primary = BlueLight,
    secondary = Blue,
    tertiary = Blue,
    background = Black
)

private val LightColorScheme = lightColorScheme(
    primary = Blue,
    secondary = BlueLight,
    tertiary = BlueLight

    /* Other default colors to override
    background = Color(0xFFFFFBFE),
    surface = Color(0xFFFFFBFE),
    onPrimary = Color.White,
    onSecondary = Color.White,
    onTertiary = Color.White,
    onBackground = Color(0xFF1C1B1F),
    onSurface = Color(0xFF1C1B1F),
    */
)

@Composable
fun AutoSilentTheme(
    darkTheme: Boolean = isSystemInDarkTheme(),
    content: @Composable () -> Unit
) {
    val colorScheme = if (darkTheme) DarkColorScheme else LightColorScheme

    MaterialTheme(
        colorScheme = colorScheme,
        typography = Typography,
        content = content
    )
}

I've scoured the docs and Stack Overflow for answers but couldn't find any. Any help will be appreciated. Thank you!


Solution

  • I was told this is intended behavior (https://issuetracker.google.com/issues/362137845). To avoid this, use enableEdgeToEdge().