我正在运行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="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>
当然,该icons
目录存在,并且文件也就位。当我使用ionic run android
或构建项目时cordova run android
。构建过程还将在platforms/android/res/drawable
目录中创建图标和启动屏幕!
另外,位于的配置文件也platforms/android/res/xml/config.xml
已正确更新,并且<preference>
and<icon>
和<splash>
element都在适当的位置。
我也尝试使用org.apache.cordova.splashscreen
插件,也没有成功。我添加了插件,ionic plugin add org.apache.cordova.splashscreen
还添加onDeviceReady
了代码navigator.splashscreen.show();
。但这也什么也没显示。
我在这里想念什么?
我自己刚遇到这个问题。改变这个
<preference name="SplashScreen" value="splash"/>
至
<preference name="SplashScreen" value="screen"/>
这样就解决了。
来源:http : //forum.ionicframework.com/t/need-help-with-displaying-splash-screen-on-android-cordova-3-6/10436/12
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句