Ionic 3-在初始屏幕显示期间隐藏状态栏 [英] Ionic 3 - Hide status bar during splash screen show

查看:82
本文介绍了Ionic 3-在初始屏幕显示期间隐藏状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有Ionic 3的应用程序,并且在您的app.component.ts中,我使用Statusbar ionic插件将其隐藏,但这仅在平台就绪启动后才会发生.

I have an app with Ionic 3 and in your app.component.ts, i using the Statusbar ionic plugin to hide that, but, this occurs only after platform ready is fired.

在启动画面期间如何隐藏它?我试过了:

How do i hide that during splashscreen? I tried:

–在启动屏幕期间不隐藏,仅在此隐藏之后 –在启动画面期间不更改背景颜色

– Not hide during splashscreen, only after this hide – Not change background color during splashscreen

解决方案?

推荐答案

Android

似乎没有优雅的方法可以在应用启动时隐藏状态栏. 但是有一种方法可以做到这一点.

It seems that there is not elegant way to hide statusbar on app launch. But there is an way to do that.

  1. 找到 MainActivity.java (也许是platforms/android/src/io/ionic/starter)
  2. 添加以下代码
  1. Find MainActivity.java (maybe platforms/android/src/io/ionic/starter)
  2. Add the below code

import android.view.WindowManager;

public class MainActivity extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        // enable Cordova apps to be started in the background
        Bundle extras = getIntent().getExtras();
        if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
            moveTaskToBack(true);
        }
        // [Hyuck] add this two line below    
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

        // Set by <content src="index.html" /> in config.xml
        loadUrl(launchUrl);
    }

    // [Hyuck] onStart() is totally new.
    @Override
    public void onStart()
    {
        super.onStart();
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    }
}

IOS

我只能测试Android设备.因此,我只留下了链接可能会解决您的问题

I can only test Android device. So, I just leave the link which may solve your issue

这篇关于Ionic 3-在初始屏幕显示期间隐藏状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆