Cordova插件使用——Statusbar定制状态栏
小编:管理员 291阅读 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是在线的,所…