全稱是:cordova-plugin-statusbar
什么時(shí)候用它呢整份?比如下面的場(chǎng)景:
image.png
因?yàn)閼?yīng)用標(biāo)題欄背景有底色,而默認(rèn)狀態(tài)欄的文字顏色為黑色籽孙,看上去就沒那么美觀烈评,所以我們可以去利用該插件改變狀態(tài)欄的文字為協(xié)調(diào)的顏色。
那實(shí)際在ionic3里是怎么使用的犯建?
因?yàn)樵摬寮琼?xiàng)目默認(rèn)安裝的讲冠,所以我們直接使用即可,打開app.component.ts
适瓦,找到下面代碼
this.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.
this.statusBar.styleDefault();
this.splashScreen.hide();
});
把this.statusBar.styleDefault()
改為this.statusBar.styleLightContent()
即可竿开,這是其中一種方式,還有其它方式玻熙,可以查看文檔:
https://github.com/apache/cordova-plugin-statusbar
其中列出其余方法如下:
StatusBar.overlaysWebView
StatusBar.styleDefault
StatusBar.styleLightContent
StatusBar.styleBlackTranslucent
StatusBar.styleBlackOpaque
StatusBar.backgroundColorByName
StatusBar.backgroundColorByHexString
StatusBar.hide
StatusBar.show