Cordova插件使用——Statusbar定制狀態欄
小編:管理員 420閱讀 2022.09.13
全稱是:cordova-plugin-statusbar
什么時候用它呢?比如下面的場景:

image.png
因為應用標題欄背景有底色,而默認狀態欄的文字顏色為黑色,看上去就沒那么美觀,所以我們可以去利用該插件改變狀態欄的文字為協調的顏色。
那實際在ionic3里是怎么使用的?
因為該插件是項目默認安裝的,所以我們直接使用即可,打開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復制
相關推薦
- Cordova 什么是Cordova? Cordova是用于使用HTML,CSS和JS構建移動應用的平臺。我們可以認為Cordova是一個容器,用于將我們的網絡應用程序與本機移動功能連接。默認情況下,Web應用程序不能使用本機移動功能。這就是Cordova進來的地方。它為網絡應用和移動設備之間的連…
- Hibernate Criterion 在查詢方法設計上能夠靈活的依據Criteria的特點來方便地進行查詢條件的組裝.Hibernate設計了CriteriaSpecification作為Criteria的父接口,以下提供了Criteria和DetachedCriteria.Criteria和DetachedCriteria的主要差別在于創建的形式不一樣,Criteria是在線的,所…