【问题标题】:Ionic 4 : Problem with Statusbar overflow contentIonic 4:状态栏溢出内容的问题
【发布时间】:2019-12-18 08:30:50
【问题描述】:

我的应用程序有点问题,StatusBar 没有正确显示,如您所见:

我用Statusbar plugin 声明了StatusBarhttps://cordova.apache.org/docs/en/latest/reference/cordova-plugin-statusbar/

app.component.ts

this.statusBar.overlaysWebView(true);
this.statusBar.show();

我可以为我所有的pagesmenu 设置一个自定义padding-top 吗? 还是显示statusbar 的正确方法?

【问题讨论】:

    标签: cordova ionic-framework statusbar


    【解决方案1】:

    app.component.ts

    initializeApp() {
        this.platform.ready().then(() => {
          this.statusBar.overlaysWebView(true);
          this.splashScreen.hide();
        });
      }
    

    pages.ts

    ionViewWillEnter() {
        this.statusBar.overlaysWebView(false); 
        this.statusBar.show();
      }
    

    【讨论】:

      【解决方案2】:

      方法 1

      您可以在 variable.scss

      内将 padding-top 添加到 ion-toolbar

      方法 2

      你可以改变你的状态栏颜色,给你的标题颜色一样的颜色。

            this.statusBar.overlaysWebView(false)
            this.statusBar.styleDefault();
            this.statusBar.styleLightContent(); //Status bar color, light if you have dark header
            this.statusBar.backgroundColorByHexString('HERE YOUR CUSTOM COLOR VALUE');
      

      【讨论】:

      • 你知道我可以设置什么值吗?取决于平台和屏幕尺寸?
      • 我可以告诉你这是正确的方法。但是如果你想保留 this.statusBar.overlaysWebView(true);我的方法行不通。编辑我的答案...
      • 我有这样的情况,它只在应用程序打开时有效,当我关闭应用程序而不关闭时,我看不到状态栏
      猜你喜欢
      • 2020-04-15
      • 2018-08-02
      • 2013-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-09
      • 2011-11-24
      • 2013-10-26
      相关资源
      最近更新 更多