首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >变色statusBar离子

变色statusBar离子
EN

Stack Overflow用户
提问于 2018-03-14 21:21:25
回答 1查看 699关注 0票数 0

我想改变安卓系统中statusBar的颜色。我用了这个代码

代码语言:javascript
复制
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    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();
      statusBar.backgroundColorByHexString('#E91E63');
      splashScreen.hide();
    });

控制台中没有错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-14 23:25:10

我找到了解决办法。显然,当您创建一个新项目时,插件状态栏是不可用的。这很奇怪,因为它已经在app.component.ts.中使用了

总之,我刚安装了插件

代码语言:javascript
复制
 $ ionic cordova plugin add cordova-plugin-statusbar

然后in app.component.ts

代码语言:javascript
复制
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();
      statusBar.backgroundColorByHexString('#87173c');
      splashScreen.hide();
    });
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49287814

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档