加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular – 在Ionic中隐藏StatusBar 2

发布时间:2020-12-17 18:05:19 所属栏目:安全 来源:网络整理
导读:我使用Ionic 2构建了一个应用程序.当我在浏览器中运行它时,UI看起来不错,但是一旦我在iOS模拟器中运行,一切看起来都很笨重.问题在于状态栏.我需要隐藏状态栏.我尝试使用离子原生的StatusBar,像这样 – import {StatusBar} from 'ionic-native';constructor(p
我使用Ionic 2构建了一个应用程序.当我在浏览器中运行它时,UI看起来不错,但是一旦我在iOS模拟器中运行,一切看起来都很笨重.问题在于状态栏.我需要隐藏状态栏.我尝试使用离子原生的StatusBar,像这样 –

import {StatusBar} from 'ionic-native';
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();
      //StatusBar.styleDefault();
    });

但实际上它没有隐藏状态栏,而是它只是覆盖状态栏颜色与我的页面标题颜色.隐藏状态栏的任何解决方案.

解决方法

我正在研究ionic3,并希望它也适用于离子2.
我也需要相同的,这是我的本地设置 –

li packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0

现在对以下文件进行更改 –

config.xml中

<preference name="Fullscreen" value="true" />

Component.ts

StatusBar.overlaysWebView(true);

这对我有用.

Note:- Changes will reflect in simulator or android phone only,not in browser.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读