最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Black text color for ios statusbar phonegapcordova - Stack Overflow

programmeradmin2浏览0评论

I'm trying to change text color of ios statusbar in my phonegap app but it's not working for me. I tried different binations of settings for cordova.statusbar plugin and core settings. Now I have this in my config.xml:

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

Which settings should I use to get black color of text in my app's statusbar?

P.S. so sorry for my English

I'm trying to change text color of ios statusbar in my phonegap app but it's not working for me. I tried different binations of settings for cordova.statusbar plugin and core settings. Now I have this in my config.xml:

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

Which settings should I use to get black color of text in my app's statusbar?

P.S. so sorry for my English

Share Improve this question edited Oct 10, 2015 at 16:40 Ilya Spark asked Oct 10, 2015 at 15:59 Ilya SparkIlya Spark 511 silver badge4 bronze badges 6
  • default is black text on white status bar, did you install the plugin? – jcesarmobile Commented Oct 10, 2015 at 17:11
  • @jcesarmobile yes I have <gap:plugin name="org.apache.cordova.statusbar" /> in my config. I also tried to put this code <preference name="StatusBarOverlaysWebView" value="false" /><preference name="StatusBarStyle" value="default" /> before and after installed plugins... – Ilya Spark Commented Oct 11, 2015 at 6:20
  • Are you using cordova or phonegap build? – jcesarmobile Commented Oct 11, 2015 at 7:40
  • @jcesarmobile yes and I see org.apache.cordova.statusbar in the list of installed plugins in the phonegap build – Ilya Spark Commented Oct 11, 2015 at 7:50
  • Yes? I'm asking if you are using cordova OR phonegap build, the answer can't be yes, has to be "I use cordova" OR "I use phonegap build" – jcesarmobile Commented Oct 11, 2015 at 10:34
 |  Show 1 more ment

3 Answers 3

Reset to default 3

Remove the first one, that doesn't exist And change the StatusBarStyle to lightcontent

<preference name="StatusBarStyle" value="lightcontent" />
StatusBar.styleDefault();

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

I am using framework 7. I need to call the above mand to set text to black. I am NOT setting style in config.xml

Use the method styleLightContent() for white text, if your status bar is black and styleDefault() for black text if your background is white.

The doc ments for this mehtods:

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

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

On Android the preference in config.xml has no effect. You have to call the methods on runtime. See docs

Unfortunately it does not set the status bar text automatically. You have to find out the theme color of the status back to decide which method you call. Or use your own fixed theme or overlay it.

发布评论

评论列表(0)

  1. 暂无评论