Cordova 离子4:状态栏溢出内容问题
我的应用程序有点问题,Cordova 离子4:状态栏溢出内容问题,cordova,ionic-framework,statusbar,Cordova,Ionic Framework,Statusbar,我的应用程序有点问题,StatusBar无法正常显示,如您所见: 我用StatusBar插件声明了StatusBar: 在app.component.ts中 this.statusBar.overlaysWebView(true); this.statusBar.show(); initializeApp() { this.platform.ready().then(() => { this.statusBar.overlaysWebView(true);
StatusBar
无法正常显示,如您所见:
我用StatusBar插件声明了StatusBar
:
在app.component.ts中
this.statusBar.overlaysWebView(true);
this.statusBar.show();
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.overlaysWebView(true);
this.splashScreen.hide();
});
}
ionViewWillEnter() {
this.statusBar.overlaysWebView(false);
this.statusBar.show();
}
我可以为我所有的页面和菜单设置自定义的填充顶部吗?
还是显示状态栏的方法正确?方法1
您可以将填充顶部添加到离子工具栏内部变量.scss
this.statusBar.overlaysWebView(true);
this.statusBar.show();
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.overlaysWebView(true);
this.splashScreen.hide();
});
}
ionViewWillEnter() {
this.statusBar.overlaysWebView(false);
this.statusBar.show();
}
方法2
您可以更改状态栏的颜色,指定与标题颜色相同的颜色
this.statusBar.overlaysWebView(false)
this.statusBar.styleDefault();
this.statusBar.styleLightContent(); //Status bar color, light if you have dark header
this.statusBar.backgroundColorByHexString('HERE YOUR CUSTOM COLOR VALUE');
应用程序组件.ts
this.statusBar.overlaysWebView(true);
this.statusBar.show();
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.overlaysWebView(true);
this.splashScreen.hide();
});
}
ionViewWillEnter() {
this.statusBar.overlaysWebView(false);
this.statusBar.show();
}
页面。ts
this.statusBar.overlaysWebView(true);
this.statusBar.show();
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.overlaysWebView(true);
this.splashScreen.hide();
});
}
ionViewWillEnter() {
this.statusBar.overlaysWebView(false);
this.statusBar.show();
}
你知道我能设定什么值吗?取决于平台和屏幕大小?我可以告诉你这是正确的方法。但是如果您想保留这个.statusBar.overlyswebview(true);我的方法行不通。编辑我的答案…我有一种情况,它只在应用程序打开时工作,当我关闭应用程序而不关闭时,我看不到状态栏