The status bar overlaps the app content in Android 15. I can’t seem to change the design of the status bar, no matter what steps I follow. Not even the color of the status bar changes. Please help. I’m new to capacitor and I’ve tried everything. I’m using Capacitor in combination with Next.js 15, i’ve also installed the status bar plugin of capacitor.
// android/app/src/main/res/values/styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:statusBarColor">#32efff</item>
</style>
This is my Header.tsx component, which is available everywhere throughout the website. I didn’t want to put this code in layout.tsx because I didn’t want my entire layout to be a client component:
useEffect(() => {
const configureStatusBar = async () => {
if (Capacitor.isNativePlatform()) {
// Prevent the status bar from overlaying the WebView
await StatusBar.setOverlaysWebView({ overlay: false });
// Set the status bar background color
await StatusBar.setBackgroundColor({ color: "#ffffff" }); // Replace with your desired color
// Set the status bar text and icon color
await StatusBar.setStyle({ style: Style.Dark }); // Use Style.Light for dark backgrounds
}
};
configureStatusBar();
}, []);
I’ve even set up the plugin in capacitor.config.ts:
plugins: {
StatusBar: {
overlaysWebView: false,
style: "DARK",
backgroundColor: "#ffffffff",
},
},