Melchia
Melchia

Reputation: 24234

Change color statusBar Ionic

I want to change the color of statusBar in ANDROID. I used this code

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      statusBar.backgroundColorByHexString('#E91E63');
      splashScreen.hide();
    });

I have no error in the console.

Upvotes: 0

Views: 723

Answers (1)

Melchia
Melchia

Reputation: 24234

I found the solution. Apparently, the plugin Status Bar isn't available when you create a new project. Which is weird cause it's already used in app.component.ts.

Anyway I just installed the plugin

 $ ionic cordova plugin add cordova-plugin-statusbar

then in app.component.ts

platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      statusBar.backgroundColorByHexString('#87173c');
      splashScreen.hide();
    });

Upvotes: 1

Related Questions