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

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

问题描述

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

import { App, Nav, Platform, Events, AlertController } from 'ionic-angular';从'@ionic-native/status-bar'导入{状态栏};构造函数(公共事件:事件,公共平台:平台,公共状态栏:状态栏){this.statusBar.overlaysWebView(true);this.statusBar.backgroundColorByHexString('#1972d2');this.statusBar.isVisible;

}

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

在 config.xml 页面中也提到过这样的

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

解决方案

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

有两种可能的解决方案:

  • 插件StatusBar未安装.即使在 app.component.ts 中提到了一个空项目,也没有正确安装.因此,您只需遵循官方文档上的指南.
  • 您的 Android 设备不支持该功能.例如,有不同的自定义 ROM 以非常规方式管理状态栏,如 MIUI、EMUI 等.您可以在 页面Cordova 插件.

无论如何,如果您执行上面列出的所有操作,它应该可以工作,但请记住进行构建以确保 100%

编辑:我已经在 MIUI 上对其进行了测试,但它的工作原理就像一个魅力,但在问题页面上,有人在某些设备上遇到了问题.也许是某个特定的版本.

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;

}

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

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

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.

There are 2 possible solutions:

  • 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.

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

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天全站免登陆