Apache Cordova 启动画面未在 Android 中显示 [英] Apache Cordova splash screens not showing in Android
问题描述
我正在运行 Apache Cordova 3.6.3-0.2.13.我尝试让启动画面正常工作.我遵循了 http://cordova 上的文档.apache.org/docs/en/3.6.0/config_ref_images.md.html#Icons%20and%20Splash%20Screens.图标正在工作,但启动画面没有成功.我们还在 Cordova 之上使用了 Ionic 框架(版本 1.2.8).
我做了什么:
从项目根目录向 config.xml 添加图标和启动画面:
<preference name="SplashScreenDelay" value="10000"/><平台名称="android"><icon src="icons/icon.png"/><!-- 您可以使用 Android 项目中存在的任何密度 --><splash src="icons/android-splash-land-hdpi.png" density="land-hdpi"/><splash src="icons/android-splash-land-ldpi.png" density="land-ldpi"/><splash src="icons/android-splash-land-mdpi.png" density="land-mdpi"/><splash src="icons/android-splash-land-xhdpi.png" density="land-xhdpi"/><splash src="icons/android-splash-port-hdpi.png" density="port-hdpi"/><splash src="icons/android-splash-port-ldpi.png" density="port-ldpi"/><splash src="icons/android-splash-port-mdpi.png" density="port-mdpi"/><splash src="icons/android-splash-port-xhdpi.png" density="port-xhdpi"/></平台>
当然,icons
目录存在,文件也已就位.当我使用 ionic run android
或 cordova run android
构建项目时.构建过程还会在 platforms/android/res/drawable
目录中创建图标和启动画面!
位于 platforms/android/res/xml/config.xml
的配置文件也已正确更新,
;
和
元素就位.我也尝试过 org.apache.cordova.splashscreen
插件,但也没有成功.我添加了带有 ionic plugin add org.apache.cordova.splashscreen
的插件,并添加了 onDeviceReady
代码 navigator.splashscreen.show();
.但这也没有显示任何东西.
我在这里遗漏了什么?
我自己也遇到过这个问题.改变这个
到
这修复了它.
I am running Apache Cordova 3.6.3-0.2.13. And I try to get the splash screens working. I have followed the documentation on http://cordova.apache.org/docs/en/3.6.0/config_ref_images.md.html#Icons%20and%20Splash%20Screens. And the icons are working, but no success for the splash screens. We are also using the Ionic framework (version 1.2.8) on top of Cordova.
What I have done:
Added icons and splash screens to config.xml from the project root:
<preference name="SplashScreen" value="splash"/>
<preference name="SplashScreenDelay" value="10000"/>
<platform name="android">
<icon src="icons/icon.png"/>
<!-- you can use any density that exists in the Android project -->
<splash src="icons/android-splash-land-hdpi.png" density="land-hdpi"/>
<splash src="icons/android-splash-land-ldpi.png" density="land-ldpi"/>
<splash src="icons/android-splash-land-mdpi.png" density="land-mdpi"/>
<splash src="icons/android-splash-land-xhdpi.png" density="land-xhdpi"/>
<splash src="icons/android-splash-port-hdpi.png" density="port-hdpi"/>
<splash src="icons/android-splash-port-ldpi.png" density="port-ldpi"/>
<splash src="icons/android-splash-port-mdpi.png" density="port-mdpi"/>
<splash src="icons/android-splash-port-xhdpi.png" density="port-xhdpi"/>
</platform>
Ofcourse the icons
directory exists and also the files are in place. When I build the project with ionic run android
or cordova run android
. The build process also creates the icons and splash screens into the platforms/android/res/drawable
directory!
Also the config file located at platforms/android/res/xml/config.xml
is correctly updated and the <preference>
and <icon>
and <splash>
elements are in place.
I also tried with the org.apache.cordova.splashscreen
plugin and also no success. I have added the plugin with ionic plugin add org.apache.cordova.splashscreen
and also added onDeviceReady
the code navigator.splashscreen.show();
. But this also shows nothing.
What am I missing here?
Just had this problem myself. Change this
<preference name="SplashScreen" value="splash"/>
to
<preference name="SplashScreen" value="screen"/>
This fixed it.
这篇关于Apache Cordova 启动画面未在 Android 中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!