可以安装状态栏插件:
$ cordova plugin add org.apache.cordova.statusbar
或者对于科尔多瓦 5.0+:
$ 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();
});
});
更多信息在这里和一个工作应用程序在这里。
离子 2 的更新
在 Ionic 2 中,情况有些不同。我们仍然需要安装cordova 插件状态栏,但我们需要从 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();
});
}
}
代码是从ionic native repository借来的。一个很好的教程可以在这里找到。