1

I am currently trying to migrate my app to be compatible with Android 15. And as far as I concerned, in order to test Android 15 API, we need set up API 35 or VanillaIceCream API. Also based on the Android 15 migration, my app is set to edge-to-edge by default (which I don't want to).

After spending time to config the app, I manage to set the app to display correctly on my VanillaIceCream API emulator, make it display the status bar.

enter image description here

However, run the app in API 35 Emulator, I get this instead:

enter image description here

Basically the status bar items, such as time, WiFi, and battery indicator blend into the white background.

CompileSDK and targetSDK are all set to 35 in app's build.gradle.kts. And in my MainActivity.kt, i implemented the insets as follow:

My_App_Theme(
    darkTheme = darkTheme
) {
    Surface(
        modifier = Modifier.windowInsetsPadding(
            insets = WindowInsets.systemBars
        ),
        color = MaterialTheme.colorScheme.background
    ) {
        MY_APP(
            darkTheme = darkTheme,
            onThemeUpdated = { darkTheme = !darkTheme }
        )
    }
}

Is this the emulator error due to the fact that Android 15 hasn't been out yet, or there is something wrong of how I implemented the insets for the edge-to-edge configuration?

0

1 Answer 1

0

You can change the color of the status bar icons using WindowInsetsControllerCompat((context as Activity).window, context.window.decorView).isAppearanceLightStatusBars.

Example

LaunchedEffect(Unit) {
    WindowInsetsControllerCompat((context as Activity).window, context.window.decorView).isAppearanceLightStatusBars = true //false for black
}
1
  • My current solutions is change my theme.xml parent into android:Theme.Material.NoActionBar, which basically does the same thing as you said. However, what I want is not just a pre-defined color like black or white for the status bar, I want it to change color based on the Material Theme like before. Commented Jul 8 at 13:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.