Ionic project in the mobile status bar display using the $cordovastatusbar plugin

Source: Internet
Author: User

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

if (Cordova.platformid = = ' Android ') {
Statusbar.backgroundcolorbyhexstring ("#333");
}else{
$cordovaStatusbar. Overlayswebview (FALSE);
$cordovaStatusbar. Style (1);
Statusbar.stylelightcontent ();
$cordovaStatusbar. Stylecolor (' black ');
}

4. Last iOS results



Please refer to Ngcordova website, http://ngcordova.com/docs/plugins/statusbar/and Https://github.com/apache/cordova-plugin-statusbar for details.



Ionic project in the mobile status bar display using the $cordovastatusbar plugin

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.