gpt4 book ai didi

android - Cordova 图标和闪屏不工作

转载 作者:太空狗 更新时间:2023-10-29 13:54:40 26 4
gpt4 key购买 nike

我在这里面临两难境地。我的 cordova 应用程序工作正常,但图标和闪屏没有,它们反射(reflect)了默认的 cordova 图标和闪屏。我的 config.xml 如下,图标和图像存在于我的目录路径中,但没有反射(reflect)出来。 cordova s​​plashcreen 插件也安装正确。我可能做错了什么?

<?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>

最佳答案

当前开发版本:

  • Cordova 版本:6.0.0
  • ionic 版本:1.7.14

请注意,我只能为自己说话:

我刚刚创建了一个测试应用程序,虽然图标有效,但启动图像也遇到了同样的问题。结果是 SplashScreenDelay 的首选项设置得太低了。当您使用 ionic 创建 cordova 项目时,SplashScreenDelay 被分配了 2 秒 (2000),这在我的例子中太低了。当我看到第一页时,2 秒就结束了。

根据 this默认值为 5 秒,但是当我删除 SplashScreenDelay 时,我也没有看到启动画面,但是当我为 SplashScreenDelay 分配 5 秒时,它就起作用了。我还注意到,当我重新打开我的应用程序时,在通过 settings 关闭应用程序后也没有启动图像。它再次显示。让我们说这里很奇怪。

因此我想推荐使用 cordova-plugin-splashscreen插件以确保无论您是否为 SplashScreenDelay 分配了较低的值,您的初始图像始终显示。

配置文件:

<?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>

项目目录:

enter image description here

关于android - Cordova 图标和闪屏不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41087286/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com