我在 Android 上使用 Ionic 时遇到了一些问题。我认为问题发生在我为我的应用程序更新 Ionic 版本时。问题是状态栏没有覆盖 webview。我尝试在 config.xml 中将 StatusBarOverlaysWebView
首选项设置为 true
并且我尝试调用全局 StatusBar
对象的不同方法成功。我可以控制状态栏的背景颜色和可见性,但我无法让它覆盖 webview。这就是它现在的样子
最佳答案
不幸的是,cordova-plugin-statusbar 中的StatusBarOverlaysWebView
方法is only supported by the iOS platform :
StatusBar.overlaysWebView
On iOS 7, make the statusbar overlay or not overlay the WebView.StatusBar.overlaysWebView(true);
Description
On iOS 7, set to false to make the statusbar appear like iOS 6. Set the style and background color to suit using the other functions.Supported Platforms
iOS
这里有一些其他的方法。检查下面的链接(但它似乎不再起作用)
http://www.martinadamko.sk/posts/translucent-bar-android-278
或者
这个怎么样?
最简单的方法如下:
/* ionic 2 app.ts */
import { Component } from '@angular/core';
import { Platform, ionicBootstrap } from 'ionic-angular';
import { StatusBar } from 'ionic-native';
@Component({
template: '<ion-nav [root]="rootPage"></ion-nav>',
})
export class App {
private rootPage: any;
constructor(private platform: Platform) {
this.rootPage = LandingPage;
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();
// Status bar theme for android
if (platform.is('android')) {
StatusBar.styleLightContent();
StatusBar.backgroundColorByHexString('#c42626');
}
});
}
}
结果是这样的:
关于android - ionic 无法使状态栏覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37134065/