简体   繁体   English

在Phonegap中将状态栏颜色更改为白色

[英]Change statusbar color to white in Phonegap

I currently develop an app with phonegap and need to change the color of the statusbar to white text, right now it is black. 我目前正在开发带有phonegap的应用,需要将状态栏的颜色更改为白色文本,现在是黑色。 I am testing on iOS 10 with the official app from PhoneGap. 我正在使用PhoneGap的官方应用程序在iOS 10上进行测试。

The statusbar-plugin is installed, I already have checked via terminal ( cordova plugin ls ). statusbar-plugin已安装,我已经通过终端( cordova plugin ls )进行了检查。 Also, the term <plugin name="cordova-plugin-statusbar" source="npm" spec="~2.1.2" /> is part of my config.xml. 另外,术语<plugin name="cordova-plugin-statusbar" source="npm" spec="~2.1.2" />是我config.xml的一部分。

I tried to change the statusbar with <preference name="StatusBarBackgroundColor" value="#000000" /> in my config.xml for example (I know this won't change the color to white, this was just a try to change the statusbar at all) – nothing has changed. 例如,我尝试在config.xml中使用<preference name="StatusBarBackgroundColor" value="#000000" />更改状态栏(我知道这不会将颜色更改为白色,这只是尝试更改状态栏)-没有任何变化。 None of the tips I found have changed anything – any ideas how to change the color? 我发现的技巧都没有改变任何东西-关于如何改变颜色的任何想法?

Okay, I got it. 知道了 Dumb mistake. 愚蠢的错误。

I deleted the default elements in index.html but forgot to edit the JS in the default index.js . 我删除了index.html的默认元素,但忘记了在默认index.js编辑JS。 After deleting the function which tried to change the missing element in my index, I finally was able to edit the StatusBar with StatusBar.styleLightContent(); 删除试图更改索引中缺少的元素的函数后,我终于可以使用StatusBar.styleLightContent();编辑StatusBar StatusBar.styleLightContent(); .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM