Cordova 3.4 Splashscreen不工作 [英] Cordova 3.4 Splashscreen not working
问题描述
我有一个Android Phonegap proyect,我想使用Splashscreen插件Cordova提供。我认为我的一切都正确设置...这里是我认为相关的代码片段。
I have an Android Phonegap proyect and I'm trying to use the Splashscreen plugin Cordova provides. I think I have everything correctly set... Here are the pieces of code I think are relevant.
Config.xml
Config.xml
<widget ...>
...
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="15000" />
<plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
</widget>
Index.html
<script type="text/javascript" charset="utf-8">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
navigator.splashscreen.hide()
}
</script>
我已经使用CLI正确安装了插件,并且splash本身是在res / drawable *文件夹在Android项目中,我认为应该是,但不管我试图做什么,飞溅没有显示。甚至不是默认的。即使我禁用navigator.splashscreen.hide()函数(如果它太快)。
I have correctly installed with the CLI the plugin and the splash itself is in the res/drawable* folders in the Android project as I think it should be, but regardless of what I try to do, the splash is not showing. Not even a default one. Not even if I disable the navigator.splashscreen.hide() function (in case it was too fast).
我现在完全失去了,一直在尝试调整一个星期,但我只是看不到它。
I'm absolutely lost now, have been trying tweaks for a week but I just can't see it.
推荐答案
我在android项目中使用cordova v3.6.3。
I'm using cordova v3.6.3 in my android project.
我读了一个API&插件文档,但我困惑了配置中的一些选项。
,但我找到了一个完美的解决方案。
I read a API & Plugin Documentations but, I confused the some options in config. but, I found a perfect solution.
1。首先,您不需要在Android项目中使用
navigator.splashscreen.hide()或.show()。
2。
3。将以下代码添加到config.xml文件中。
※不要更改value =screen。
只需更改初始屏幕图像的src和延迟值。
3. Add following codes into your config.xml file. ※ Do not change the value="screen". you just change the src and delay value for your splashscreen image.
[Config.xml]
$ b
[Config.xml]
<platform name="android">
<splash src="www/res/screen/android/screen-default.png" />
</platform>
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="4000" />
4。
5。在你的命令行上创建你的项目(cordova build android)
,再看一下drawable目录。
我会承诺,成功。 : - )
I'll promise, you'll success. :-)
这篇关于Cordova 3.4 Splashscreen不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!