我想改变安卓系统中statusBar的颜色。我用了这个代码
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();
});控制台中没有错误。
发布于 2018-03-14 23:25:10
我找到了解决办法。显然,当您创建一个新项目时,插件状态栏是不可用的。这很奇怪,因为它已经在app.component.ts.中使用了
总之,我刚安装了插件
$ ionic cordova plugin add cordova-plugin-statusbar然后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();
});https://stackoverflow.com/questions/49287814
复制相似问题