[英]cordova icons and splashscreen not working
Am facing a dilemma here.My cordova app works fine however the icons and splashscreen dont , they reflect to default cordova icons and splashscreen . 我在这里面临困境。我的cordova应用程序工作正常,但图标和splashscreen不,他们反映默认的cordova图标和splashscreen。 My config.xml is as below , the icon and image exist in my directory path, but they are not being reflected .
我的config.xml如下所示,图标和图像存在于我的目录路径中,但它们没有被反映出来。 The cordova splashcreen plugin is also installed correctly .
cordova splashcreen插件也正确安装。 what might i be doing wrong ?
我可能做错了什么?
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.something.portal" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Someapp</name>
<description>
Someapp
</description>
<author email="cliffjimmy27@gmail.com" href="https://gmail.com">
Obonyo Jimmycliff
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<access origin="cdvfile://*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<icon src="res/icon.png" />
<platform name="android">
<allow-intent href="market:*" />
<splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/>
<splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/>
<splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/>
<splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/>
<splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/>
<splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/>
<splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/>
<splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<plugin name="cordova-plugin-splashscreen" spec="~4.0.0" />
<plugin name="cordova-plugin-camera" spec="~2.3.0" />
<plugin name="cordova-plugin-file-transfer" spec="~1.6.0" />
<plugin name="cordova-plugin-file" spec="~4.3.0" />
<plugin name="cordova-plugin-geolocation" spec="~2.4.0" />
</widget>
Current Dev-Versions: 当前的Dev-Versions:
Please not that I just can speak for myself: 请注意,我只能为自己说话:
I just created a testapp and although the icon worked I got the same problem with the splash-images too. 我刚刚创建了一个testapp,虽然图标工作,我也遇到了与splash-images相同的问题。 It turned out that the preference SplashScreenDelay was set too low.
事实证明, SplashScreenDelay的偏好设置得太低了。 When you create an cordova-project by using ionic, the SplashScreenDelay is assigned with 2 seconds(2000) that in my case was is too low.
当您使用ionic创建cordova项目时, SplashScreenDelay被指定为2秒(2000),在我的情况下太低了。 As soon as I saw the first page the 2 seconds were over.
当我看到第一页时,2秒就结束了。
According to this the default is 5 seconds but when I removed SplashScreenDelay , I saw no splash-image either but as soon as I assigned 5 seconds to SplashScreenDelay it worked. 根据这个默认是5秒,但是当我删除SplashScreenDelay时 ,我看到没有启动图像,但是只要我为SplashScreenDelay分配5秒就可以了。 I also noticed that when I reopened my app there was no splash-image either after closing the app via settings it was shown again.
我还注意到,当我重新打开我的应用程序时,通过再次显示的设置关闭应用程序之后没有启动图像。 Lets say its strange here.
让我们说这里很奇怪。
Therefore I would like to recommend to use the cordova-plugin-splashscreen plugin to make sure that your splash-image is always shown no matter whether you assigned a low value to SplashScreenDelay or not. 因此,我建议使用cordova-plugin-splashscreen插件,以确保无论您是否为SplashScreenDelay指定了较低的值,都会始终显示您的启动图像。
config.xml: config.xml文件:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.testapp128533" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>testapp</name>
<description>
An Ionic Framework and Cordova project.
</description>
<author email="you@example.com" href="http://example.com/">
Your Name Here
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="SplashScreenDelay" value="5000"/>
<icon src="icon.png" />
<platform name="android">
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi/screen.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi/screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi/screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi/screen.png" />
<splash density="hdpi" src="resources/android/splash/drawable-hdpi/screen.png" />
<splash density="ldpi" src="resources/android/splash/drawable-ldpi/screen.png" />
<splash density="mdpi" src="resources/android/splash/drawable-mdpi/screen.png" />
<splash density="xhdpi" src="resources/android/splash/drawable-xhdpi/screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-xhdpi/screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-xhdpi/screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-xhdpi/screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-xhdpi/screen.png" />
<splash density="xxhdpi" src="resources/android/splash/drawable-xhdpi/screen.png" />
<splash density="xxxhdpi" src="resources/android/splash/drawable-xhdpi/screen.png" />
</platform>
</widget>
Project-Directory: 项目目录:
Cordova does not support all ios devices. Cordova不支持所有ios设备。 To generate all possible icons and splash screens with one single file I can only recommend using
cordova-icon
and cordova-splash
要使用单个文件生成所有可能的图标和启动画面,我只能建议使用
cordova-icon
和cordova-splash
The instructions are easy to follow and I had everything up and running within 5 minutes. 这些说明很容易理解,我在5分钟内完成了所有工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.