PhoneGap的3.1 - 无法隐藏闪屏设备上的准备 [英] phonegap 3.1 - Unable to hide splash screen on device ready

查看:216
本文介绍了PhoneGap的3.1 - 无法隐藏闪屏设备上的准备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PhoneGap的3.1我试图隐藏闪屏时,设备已准备就绪:

Using phonegap 3.1 I'm trying to hide the splash screen when device is ready:

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
 navigator.splashscreen.hide();
}

但它返回:

不能调用未定义的方法隐藏

Cannot call method 'hide' of undefined

导航器对象不包括启动画面的属性。

The navigator object doesn't including the splashscreen attribute.

我试过它的PhoneGap 2.9,它工作正常。

I've tried it on phonegap 2.9 and it works fine.

推荐答案

研究和实验后,这是我们必须做的,为了得到它的工作:

After research and experiments this is what we had to do in order to get it work:

科尔多瓦插件添加org.apache.cordova.splashscreen

科尔多瓦构建

然后,科尔多瓦构建被添加了错误的行到config.xml - 因此,我们不得不将其更改为以下内容:

Then, cordova build was adding the wrong lines to the config.xml - So we had to change it to the following:

 <feature name="SplashScreen">
        <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
 </feature>

而在你的主要活动

And in your main activity

 super.setIntegerProperty("splashscreen", R.drawable.splash);
 super.setIntegerProperty("splashScreenDelay", 10000); //time to display the splash

最后,我们已经能够从JavaScript中使用隐藏方法。

这篇关于PhoneGap的3.1 - 无法隐藏闪屏设备上的准备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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