您可以安装状态栏插件:
$ cordova plugin add org.apache.cordova.statusbar
or for 科尔多瓦 5.0+ https://github.com/apache/cordova-plugin-statusbar:
$ cordova plugin add cordova-plugin-statusbar
并隐藏状态栏:StatusBar.hide();
.controller('MyCtrl', function($scope) {
ionic.Platform.ready(function() {
// hide the status bar using the StatusBar plugin
StatusBar.hide();
});
});
更多信息here http://ionicframework.com/docs/api/utility/ionic.Platform/#fullScreen和一个工作应用程序here https://github.com/driftyco/ionic-weather.
Ionic 2 更新
在 Ionic 2 中,事情有点不同的 http://ionicframework.com/docs/v2/native/status-bar/。
我们还需要安装cordova插件状态栏 https://github.com/apache/cordova-plugin-statusbar#cordova-plugin-statusbar但我们需要从 ionic Native 导入状态栏:
import {StatusBar} from 'ionic-native';
主类应该大致如下所示:
import {App, Platform} from 'ionic/ionic';
import {HomePage} from './home/home';
import './app.scss';
import {StatusBar} from 'ionic-native';
@App({
template: `
<ion-nav [root]="root"></ion-nav>
<ion-overlay></ion-overlay>
`,
})
export class MyApp {
constructor(platform: Platform) {
this.platform = platform;
this.initializeApp();
this.root = HomePage;
}
initializeApp() {
this.platform.ready().then(() => {
console.log('Platform ready');
StatusBar.hide();
});
}
}
该代码借自离子本机存储库 https://github.com/driftyco/ionic-native/blob/master/demo/www/app/app.js。可以找到一个很好的教程here http://www.gajotres.net/ionic-2-tutorial-lets-create-our-first-application/.