使用phonegap 3.1我正试图在设备准备好时隐藏启动画面:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
navigator.splashscreen.hide();
}
Run Code Online (Sandbox Code Playgroud)
但它返回:
无法调用未定义的方法'hide'
导航器对象不包含splashscreen属性.
我已经在phonegap 2.9上尝试过,它运行正常.
gri*_*ure 10
经过研究和实验,这是我们为了使其工作所必须做的事情:
cordova plugin add org.apache.cordova.splashscreen
cordova build
然后,cordova构建在config.xml中添加了错误的行 - 所以我们必须将其更改为以下内容:
<feature name="SplashScreen">
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>
Run Code Online (Sandbox Code Playgroud)
在你的主要活动中
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.setIntegerProperty("splashScreenDelay", 10000); //time to display the splash
Run Code Online (Sandbox Code Playgroud)
最后我们已经能够使用hidejavascript方法了.