Title: Android 15: Status bar and navigation bar overlapping app, color stays transparent instead of following app theme
Body: I am building a React + Ionic mobile app with Capacitor. After updating to Android 15 (targetSdk 35), the status bar and navigation bar started overlapping the app content.
I fixed the overlap by updating my MainActivity.java like this:
`public class MainActivity extends BridgeActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
ViewCompat.setOnApplyWindowInsetsListener( findViewById(android.R.id.content), (v, windowInsets) -> { Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); v.setPadding(insets.left, insets.top, insets.right, insets.bottom); return WindowInsetsCompat.CONSUMED; } ); }
}`
This resolves the layout overlap.
Problem: Now the status bar color remains transparent. Depending on the device theme, it shows a light transparent or dark transparent background. But I want the status bar to take a solid color based on my app’s theme (e.g., solid white in light theme, solid black in dark theme).
Question: How can I correctly set the status bar background color in Android 15 so it follows the app theme instead of the system theme transparency?
Is there an official way documented for Android 15?
Should this be handled via styles.xml (DayNight theme) or programmatically in MainActivity.java?
Expected behavior:
In light theme → solid white status bar
In dark theme → solid black status bar
Not transparent
What I’ve tried:
window.setStatusBarColor(Color.WHITE) and Color.BLACK, but Android 15 still forces a translucent effect.
Setting theme attributes in styles.xml, but the system seems to override with transparent color
What I’ve tried:
window.setStatusBarColor(Color.WHITE) and Color.BLACK, but Android 15 still forces a translucent effect.
Setting theme attributes in styles.xml, but the system seems to override with transparent color.
could you please help on this currently Im using java 17 and capacitor 6. using @capawesome/capacitor-android-edge-to-edge-support plugin , capacitor 6 has to be upgraded to 7 and java 21.So Is therre any way to change the backgroudn colro of statubar without doing this