ios状态栏phonegap / cordova的黑色文字颜色

时间:2015-10-10 15:59:06

标签: javascript ios cordova

我正在尝试在我的phonegap应用中更改ios状态栏的文字颜色,但这对我不起作用。 我尝试了cordova.statusbar插件和核心设置的不同设置组合。 现在我在config.xml中有这个:

<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarStyle" value="default" />

我应该使用哪些设置在应用的状态栏中获取文字的黑色颜色?

P.S。很抱歉我的英文

3 个答案:

答案 0 :(得分:2)

删除第一个不存在的 并将StatusBarStyle更改为lightcontent

<preference name="StatusBarStyle" value="lightcontent" />

答案 1 :(得分:1)

StatusBar.styleDefault();

https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-statusbar/

我正在使用框架7.我需要调用上面的命令将文本设置为黑色。我没有在config.xml中设置样式

答案 2 :(得分:0)

如果状态栏为黑色,则对白色文本使用styleLightContent()方法;如果背景为白色,则对黑色文本使用styleDefault()方法。

此方法的文档注释:

// Use the default statusbar (dark text, for light backgrounds).
statusBar.styleDefault();

// Use the lightContent statusbar (light text, for dark backgrounds).
statusBar.styleLightContent();

在Android上,preference中的config.xml无效。您必须在运行时调用方法。 See docs

不幸的是,它不会自动设置状态栏文本。 您必须找出状态的主题颜色来决定调用哪种方法。或使用您自己的固定主题或将其覆盖。

相关问题