Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 如何在Ionic 3/Crodova中创建无状态栏的全屏应用程序_Angular_Cordova_Typescript_Ionic Framework_Ionic3 - Fatal编程技术网

Angular 如何在Ionic 3/Crodova中创建无状态栏的全屏应用程序

Angular 如何在Ionic 3/Crodova中创建无状态栏的全屏应用程序,angular,cordova,typescript,ionic-framework,ionic3,Angular,Cordova,Typescript,Ionic Framework,Ionic3,我正在尝试在Ionic3/Cordova/Angular中创建一个全屏应用程序 我搜索了很多,但找不到有效的解决方案。 我尝试过但失败了(不确定这是否是一个糟糕的实现) 我希望应用程序从开始到应用程序中的每一页都是全屏的,没有iOS和Android中的状态栏 使用status.hide() constructor(public navCtrl: NavController, public status: StatusBar) { status.hide(); } 非常感谢您的帮

我正在尝试在Ionic3/Cordova/Angular中创建一个全屏应用程序

我搜索了很多,但找不到有效的解决方案。 我尝试过但失败了(不确定这是否是一个糟糕的实现)

我希望应用程序从开始到应用程序中的每一页都是全屏的,没有iOS和Android中的状态栏

使用
status.hide()

  constructor(public navCtrl: NavController, public status: StatusBar) {
    status.hide();
  }
非常感谢您的帮助


谢谢

您需要在
this.platform.ready()
事件中调用它,如下所示。也许您可以考虑
IonViewDiCenter()
生命周期事件,而不是
构造函数()

  constructor(private platform: Platform, private status: StatusBar) {
    this.initializeApp();
  }

  initializeApp() {
    this.platform.ready().then(() => {
       this.status.hide();
    });
  }

使用离子本机状态栏:

npm install @ionic-native/core --save
ionic cordova plugin add cordova-plugin-statusbar
npm install --save @ionic-native/status-bar
将插件添加到应用程序的模块中

    ` ...

        import { StatusBar} from '@ionic-native/status-bar';

    ...

@NgModule({
  ...

  providers: [
    ...
    StatusBar
    ...
  ]
  ...
})
export class AppModule { }

`
然后在您的根页面或app.component.ts中使用它:

    import { StatusBar } from '@ionic-native/status-bar';

   constructor(platform: Platform) {
      platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.hide();

    });
  }

有关详细信息:

将此添加到index.html

它可以在iOS上运行,但不会隐藏状态栏的文本

<meta name="viewport" content="viewport-fit=cover, initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width" />

在标题中添加类

<ion-header class="absent-header">

在我的问题中,我使用并给出的作为示例的实现实际上是有效的,我的问题是从一开始就让它全屏显示。意思是从您打开应用程序的那一刻(爱奥尼亚闪屏启动的那一刻)起,希望您能在
app.component.ts
文件号上给出上述信息@梅尔基亚在他的回答中也提到了这一点。在这里使用它,当设备准备好时。。意味着我们已经通过了Ionic启动屏幕(在Ionic初始化之后)
page-home {
   .absent-header {
        display: none;
   }
}