Found in the project Android and iOS in the phone status bar style is not the same, and then found that there is a Cordova plug-in can solve the problem
1. Download plugins$cordovaStatusbar命令:
cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git
2. Configure the following in config:
<feature name= "StatusBar" >
<param name= "Ios-package" onload= "true" value= "Cdvstatusbar"/>
</feature>
Change this configuration to:
<preference name= "fullscreen" value= "false"/> (otherwise the status bar on Android does not show up)
3. Inside the App.js, as follows:
Determine whether the phone is Android or iOS to define a different style, my this is on Android and iOS are background color black, the font is white
[JavaScript]View PlainCopy
- if (Cordova.platformid = = ' Android ') {
- Statusbar.backgroundcolorbyhexstring ("#333");
- }else{
- $cordovaStatusbar. Overlayswebview (false);
- $cordovaStatusbar. Style (1);
- Statusbar.stylelightcontent ();
- $cordovaStatusbar. Stylecolor (' black ');
- }
4. Last iOS results
Ionic items in the phone status bar display using the $cordovastatusbar plugin