Reputation: 711
I have been trying to change status bar color in Ionic App with the following method:
import { StatusBar } from '@ionic-native/status-bar';
constructor(private statusBar: StatusBar) { }
this.statusBar.overlaysWebView(true);
this.statusBar.backgroundColorByHexString('#ffffff');
But still the status bar color doesn't change.
Upvotes: 2
Views: 6770
Reputation: 782
Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-statusbar
$ npm install --save @ionic-native/status-bar@4 // @4 for ionic 3
import { StatusBar } from '@ionic-native/status-bar';
constructor(private statusBar: StatusBar) { }
...
// let status bar overlay webview
this.statusBar.overlaysWebView(true);
// set status bar to white
this.statusBar.backgroundColorByHexString('#ffffff');
see ionic 3 status bar
Upvotes: 4
Reputation: 711
Finally found the solution after days of searching. First install
ionic cordova plugin add cordova-plugin-statusbar
npm install --save @ionic-native/status-bar
then add the following to the config.xml
<preference name="StatusBarBackgroundColor" value="#2873ed" />
<preference name="StatusBarOverlaysWebView" value="true" />
Upvotes: 8