Cordova插件使用——Statusbar定制狀態欄
小編:管理員 543閱讀 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進來的地方。它為網絡應用和移動設備之間的連…
- 3DMAX使用“材質資源管理器”的“場景”面板管理材質 要更改材質分配,請執行以下操作之一:將“材質資源管理器”的“場景”面板中材質的縮略圖或圖標(位于材質名稱的左側)拖動到視口中的某個對象上。 選擇多個對象,然后將“材質資源管理器”的“場景”面板中材質的縮略圖或圖標(位于材質名稱的左側)拖動到其…