状态栏在Ionic 3中不起作用 [英] Status bar not working in ionic 3

查看:78
本文介绍了状态栏在Ionic 3中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是IONIC 3的新手,我只想在我的应用中实现状态栏.我尝试了以下方法.

I am newbie in IONIC 3, I just want to implement status bar to my app. I tried following methods.

import { App, Nav, Platform, Events, AlertController  } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';

constructor(public events: Events, public platform: Platform,   publicstatusBar: StatusBar) {

this.statusBar.overlaysWebView(true);
this.statusBar.backgroundColorByHexString('#1972d2');
this.statusBar.isVisible;

}

并更改了index.html页面,作为此链接中提到的解决方案

and Changed in index.html page as solution mentioned in this link

<meta name="theme-color" content="#1976d2">

,并且在config.xml页面中也这样提及

and also mentioned in config.xml page like this

<preference name="StatusBarBackgroundColor" value="#1972d2" />
<preference name="StatusBarOverlaysWebView" value="true" />

可能是什么问题?请帮我.

What might be the issue? Please help me.

推荐答案

您所做的一切都是正确的.

Everything you did is correct.

有2种可能的解决方案:

There are 2 possible solutions:

  • 未安装插件StatusBar .即使在app.component.ts中提到了一个空项目,也未正确安装.因此,您只需遵循官方文档上的指南即可.
  • 您的android设备不支持该功能.例如,有不同的自定义ROM以非常规的方式管理状态栏,例如MIUI,EMUI等.您可以在
  • the plugin StatusBar is not installed. Even if in an empty project in the app.component.ts is mentioned, is not installed properly. So you have just to follow this guide on the official documentation.
  • your android device does not support that feature. For example, there are different custom ROMs that manage the status bar in an unconventional way like MIUI, EMUI, etc. You can check that on this page that collects issues of the Cordova plugin.

无论如何,如果您执行上面列出的所有操作,都可以使用,但请记住要进行构建以确保100%正确

Anyway, if you do everything listed above it should work but remember to make a build to be sure at 100%

EDIT :我已经在MIUI上对其进行了测试,但它的工作原理很吸引人,但是在问题页面上,有人在某些设备上遇到了问题.也许是某些特定版本.

EDIT: I've tested it on the MIUI and it works like a charm though, but on the issue page someone got a problem on some device. Maybe it's some particular version.

这篇关于状态栏在Ionic 3中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆