
我的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();
});
}没什么用。
发布于 2018-05-10 19:22:20
我已经找到了解决办法。对我来说很管用
statusBar.overlaysWebView(true);
statusBar.backgroundColorByHexString('#1f2933');发布于 2019-06-05 03:56:56
在我的例子中,我需要更改IOS中的状态栏背景色和内容颜色。
首先,我需要安装插件.
ionic cordova plugin add cordova-plugin-statusbar
npm install --save @ionic-native/status-bar@4 // version 4 since ionic 3然后in 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
});
}最后我得到了我想要的

发布于 2018-04-30 11:00:56
如果你没有插件的状态栏。然后你就能做到-
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})https://stackoverflow.com/questions/50099026
复制相似问题