【问题标题】:splashscreen does not hide闪屏不隐藏
【发布时间】:2017-03-24 16:22:21
【问题描述】:

我输入了 app.ts:

import { Splashscreen } from 'ionic-native';

在构造函数内部:

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.styleDefault();
      this.hideSplashScreen()
 }

功能:

hideSplashScreen() {
    if(navigator && navigator.splashscreen) {
    setTimeout(()=> {
       navigator.splashscreen.hide();
    }, 100);
}

in config.xml:
<preference name="ShowSplashScreen" value="true"/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="30000"/>
  <preference name="AutoHideSplashScreen" value="false"/>
  <preference name="SplashShowOnlyFirstTime" value="false"/>
  <preference name="FadeSplashScreen" value="false"/>
  <feature name="SplashScreen">
      <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen"/>
  </feature>

在打字方面,我的 pluginshackyhacky.d.ts 是:

interface /*PhoneGapNavigator extends*/ Navigator {
  app: any;
  splashscreen: Splashscreen;
}

在设备和模拟器中,Slash screen 完全没有隐藏...

只要我输入“启动画面:启动画面;”在 pluginshackyhacky.d.ts 文件中,Ionic 在控制台中输出 404 错误: http://localhost:8100/build/js/app.bundle.js 加载资源失败:服务器响应状态为404(未找到)

有我的错误或 RC0 不适用于 slpashscreen?

彼得罗

【问题讨论】:

    标签: android ionic2 splash-screen


    【解决方案1】:

    ionic 2.3.0 版本更新

    要隐藏启动画面,请从 ionic native 导入启动画面并创建对象以使用该方法

    import { SplashScreen } from '@ionic-native/splash-screen';
    export class your_class{
    public splashScreen: SplashScreen;
     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.
          this.splashScreen.hide();
        });
      }
    }
    

    2.0 版

    在构造函数中使用以下代码

    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.styleDefault();
          Splashscreen.hide();
     }
    

    Ionic 原生 Splashscreen 具有处理启动画面的所有方法。不需要打字

    【讨论】:

    • 谢谢。我读到了 ionic 2 中未修复的某个地方。你知道吗,因为如果我关闭应用程序并再次打开(没有清理内存),飞溅不会上升,并且在应用程序准备好之前屏幕是白色的?
    • CLOSED:我把这行: 我以为是默认的。
    猜你喜欢
    • 1970-01-01
    • 2015-08-11
    • 2015-04-30
    • 1970-01-01
    • 2016-03-19
    • 2010-11-11
    • 1970-01-01
    • 1970-01-01
    • 2017-12-07
    相关资源
    最近更新 更多