我的config.xml
<preference name="StatusBarOverlaysWebView" value="true" />
<preference name="StatusBarStyle" value="lightcontent" />
我的app.component
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
statusBar.styleLightContent();
splashScreen.hide();
});
}
没有用。
答案 0 :(得分:0)
如果您没有状态栏的ng-cordova插件。然后你可以这样做 -
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
答案 1 :(得分:0)
也许你可以在你的platform.ready()。then(()=&gt;方法
中尝试这个
StatusBar.overlaysWebView(false);
StatusBar.backgroundColorByHexString('#00FFFF');
&#13;
答案 2 :(得分:0)
我找到了解决方案。它对我有用
statusBar.overlaysWebView(true);
statusBar.backgroundColorByHexString('#1f2933');
答案 3 :(得分:0)
this.statusBar.backgroundColorByHexString('transparent');
答案 4 :(得分:0)
就我而言,我需要在 IOS 中更改状态栏的背景颜色和内容颜色。
首先我需要安装插件。
ionic cordova plugin add cordova-plugin-statusbar
npm install --save @ionic-native/status-bar@4 // version 4 since ionic 3
然后在app.comopenet.ts
constructor(statusBar: StatusBar, platform: Platform) {
platform.ready().then(() => {
statusBar.overlaysWebView(false);
// overlaysWebView must set to false if you change the background color in iOS with ionic (hence I am using backgroundColorByHexString method )
statusBar.backgroundColorByHexString('#c8102e');
// used above hex color code to set the status bar background color
statusBar.styleLightContent();
// above function will change the status bar content (icon , text)
statusBar.show();
// finally shows the status bar
});
}
最后我得到了我需要的东西