更改Android状态栏颜色在Cordova中 [英] Change Android Statusbar color In Cordova

查看:435
本文介绍了更改Android状态栏颜色在Cordova中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改Android中的状态栏颜色(我正在使用6.0进行测试)。我尝试了状态栏插件和我找到的所有解决方案,但没有任何效果。

I want to change the Status bar color in Android (I'm using 6.0 for testing). I tried the statusbar plugin and all the solutions I found for it but nothing worked.

这包含在我的config.xml中< widget>

This is included in my config.xml <widget>:

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

我的index.js不包括:

My index.js uncludes:

if (window.cordova && StatusBar)
{
    StatusBar.backgroundColorByHexString('#3399FF');
}

为每个包名添加插件和github repo。

Added the plugin per package name and github repo.

到目前为止没有任何工作......

Nothing worked so far...

提前致谢! :)

推荐答案

Statusbar插件将工作。从config.xml移除这些行

Statusbar plugin will work.Remove these lines from config.xml

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

并写 StatusBar.backgroundColorByHexString('#3399FF'); 内部 deviceready 如下所示

document.addEventListener('deviceready', function(){
StatusBar.backgroundColorByHexString('#3399FF');});

这篇关于更改Android状态栏颜色在Cordova中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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