菜鸟教程小白 发表于 2022-12-13 00:32:59

android - Cordova 闪屏未在 android 或 iOS 中加载


                                            <p><p>我正在使用 VS 2015 和 Cordova CLI 6.1.1。
我无法让启动屏幕正常工作,也无法用于 Android,也无法用于 iOS。该图标在 Android 中显示正常,但在 iOS 中显示不正常。这是我的 config.xml:</p>

<pre><code>    &lt;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34; standalone=&#34;yes&#34;?&gt;
&lt;widget id=&#34;hr.studio.whatever.dev&#34; version=&#34;1.0.4&#34; xmlns=&#34;http://www.w3.org/ns/widgets&#34; xmlns:cdv=&#34;http://cordova.apache.org/ns/1.0&#34; defaultlocale=&#34;en-EN&#34; android-versionCode=&#34;20170404&#34;&gt;
&lt;name&gt;Whatever&lt;/name&gt;
&lt;description&gt;
      An Ionic Framework and Cordova project for Visual Studio
    &lt;/description&gt;
&lt;author email=&#34;[email protected]&#34; href=&#34;http://taco.visualstudio.com&#34;&gt;Visual Studio JS Mobile Tooling&lt;/author&gt;
&lt;content src=&#34;index.html&#34; /&gt;
&lt;access origin=&#34;*&#34; /&gt;
&lt;preference name=&#34;webviewbounce&#34; value=&#34;false&#34; /&gt;
&lt;preference name=&#34;UIWebViewBounce&#34; value=&#34;false&#34; /&gt;
&lt;preference name=&#34;DisallowOverscroll&#34; value=&#34;true&#34; /&gt;
&lt;preference name=&#34;android-minSdkVersion&#34; value=&#34;15&#34; /&gt;
&lt;preference name=&#34;BackupWebStorage&#34; value=&#34;none&#34; /&gt;
&lt;preference name=&#34;SplashScreen&#34; value=&#34;screen&#34; /&gt;
&lt;preference name=&#34;SplashScreenDelay&#34; value=&#34;3000&#34; /&gt;
&lt;preference name=&#34;windows-target-version&#34; value=&#34;10.0&#34; /&gt;
&lt;preference name=&#34;KeyboardDisplayRequiresUserAction&#34; value=&#34;false&#34; /&gt;
&lt;feature name=&#34;StatusBar&#34;&gt;
    &lt;param name=&#34;ios-package&#34; onload=&#34;true&#34; value=&#34;CDVStatusBar&#34; /&gt;
&lt;/feature&gt;
&lt;plugin name=&#34;cordova-plugin-device&#34; spec=&#34;~1.1.2&#34; /&gt;
&lt;plugin name=&#34;cordova-plugin-console&#34; spec=&#34;~1.0.3&#34; /&gt;
&lt;plugin name=&#34;cordova-plugin-whitelist&#34; spec=&#34;~1.2.2&#34; /&gt;
&lt;plugin name=&#34;cordova-plugin-splashscreen&#34; spec=&#34;~3.1.0&#34; /&gt;
&lt;plugin name=&#34;cordova-plugin-statusbar&#34; spec=&#34;~2.1.3&#34; /&gt;
&lt;plugin name=&#34;ionic-plugin-keyboard&#34; spec=&#34;~2.1.0&#34; /&gt;
&lt;platform name=&#34;android&#34;&gt;
    &lt;icon src=&#34;resources/android/icon/mipmap-ldpi/ic_launcher.png&#34; density=&#34;ldpi&#34; /&gt;
    &lt;icon src=&#34;resources/android/icon/mipmap-mdpi/ic_launcher.png&#34; density=&#34;mdpi&#34; /&gt;
    &lt;icon src=&#34;resources/android/icon/mipmap-hdpi/ic_launcher.png&#34; density=&#34;hdpi&#34; /&gt;
    &lt;icon src=&#34;resources/android/icon/mipmap-xhdpi/ic_launcher.png&#34; density=&#34;xhdpi&#34; /&gt;
    &lt;icon src=&#34;resources/android/icon/mipmap-xxhdpi/ic_launcher.png&#34; density=&#34;xxhdpi&#34; /&gt;
    &lt;icon src=&#34;resources/android/icon/mipmap-xxxhdpi/ic_launcher.png&#34; density=&#34;xxxhdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-land-ldpi-screen.png&#34; density=&#34;land-ldpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-land-mdpi-screen.png&#34; density=&#34;land-mdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-land-hdpi-screen.png&#34; density=&#34;land-hdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-land-xhdpi-screen.png&#34; density=&#34;land-xhdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-land-xxhdpi-screen.png&#34; density=&#34;land-xxhdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-land-xxxhdpi-screen.png&#34; density=&#34;land-xxxhdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-port-ldpi-screen.png&#34; density=&#34;port-ldpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-port-mdpi-screen.png&#34; density=&#34;port-mdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-port-hdpi-screen.png&#34; density=&#34;port-hdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-port-xhdpi-screen.png&#34; density=&#34;port-xhdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-port-xxhdpi-screen.png&#34; density=&#34;port-xxhdpi&#34; /&gt;
    &lt;splash src=&#34;resources/android/splash/drawable-port-xxxhdpi-screen.png&#34; density=&#34;port-xxxhdpi&#34; /&gt;
&lt;/platform&gt;
&lt;platform name=&#34;ios&#34;&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;20&#34; height=&#34;20&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;20&#34; height=&#34;20&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;29&#34; height=&#34;29&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;29&#34; height=&#34;29&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;29&#34; height=&#34;29&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;40&#34; height=&#34;40&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;40&#34; height=&#34;40&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;40&#34; height=&#34;40&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;57&#34; height=&#34;57&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;57&#34; height=&#34;57&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;60&#34; height=&#34;60&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;60&#34; height=&#34;60&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;60&#34; height=&#34;60&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;76&#34; height=&#34;76&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;83.5&#34; height=&#34;83.5&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;50&#34; height=&#34;50&#34; /&gt;
    &lt;icon src=&#34;resources/ios/icon/[email protected]&#34; width=&#34;50&#34; height=&#34;50&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default@2x~iphone.png&#34; height=&#34;960&#34; width=&#34;640&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default~iphone.png&#34; height=&#34;480&#34; width=&#34;320&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default-568h@2x~iphone.png&#34; height=&#34;1136&#34; width=&#34;640&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default-667h.png&#34; height=&#34;1334&#34; width=&#34;750&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default-736h.png&#34; height=&#34;2208&#34; width=&#34;1242&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default-Landscape@2x~ipad.png&#34; height=&#34;1536&#34; width=&#34;2048&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default-Landscape@2x~ipad.png&#34; height=&#34;2048&#34; width=&#34;1536&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default-Landscape~ipad.png&#34; height=&#34;768&#34; width=&#34;1024&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default-Landscape-736h.png&#34; height=&#34;1242&#34; width=&#34;2208&#34; /&gt;
    &lt;splash src=&#34;resources/ios/splash/Default-Portrait~ipad.png&#34; height=&#34;1024&#34; width=&#34;768&#34; /&gt;
&lt;/platform&gt;
&lt;platform name=&#34;windows&#34;&gt;
    &lt;preference name=&#34;SplashScreenBackgroundColor&#34; value=&#34;#ffffff&#34; /&gt;
    &lt;splash src=&#34;resources/windows/splash/Splash620x300.scale-100.png&#34; width=&#34;620&#34; height=&#34;300&#34; /&gt;
    &lt;icon src=&#34;resources/windows/icon/logo150x150.scale-100.png&#34; width=&#34;150&#34; height=&#34;150&#34; /&gt;
    &lt;icon src=&#34;resources/windows/icon/logo310x310.scale-100.png&#34; width=&#34;310&#34; height=&#34;310&#34; /&gt;
    &lt;icon src=&#34;resources/windows/icon/logo44x44.scale-100.png&#34; width=&#34;44&#34; height=&#34;44&#34; /&gt;
    &lt;icon src=&#34;resources/windows/icon/logo50x50.scale-100.png&#34; width=&#34;50&#34; height=&#34;50&#34; /&gt;
    &lt;icon src=&#34;resources/windows/icon/logo30x30.scale-100.png&#34; width=&#34;30&#34; height=&#34;30&#34; /&gt;
    &lt;icon src=&#34;resources/windows/icon/logo71x71.scale-100.png&#34; width=&#34;71&#34; height=&#34;71&#34; /&gt;
    &lt;icon src=&#34;resources/windows/icon/wide310x150.scale-100.png&#34; width=&#34;310&#34; height=&#34;150&#34; /&gt;
&lt;/platform&gt;
&lt;plugin name=&#34;cordova-plugin-ace&#34; version=&#34;0.1.2&#34; src=&#34;https://github.com/adnathan/ace&#34; /&gt;
&lt;preference name=&#34;deployment-target&#34; value=&#34;9.0&#34; /&gt;
&lt;/widget&gt;
</code></pre>

<p>我向你保证,我已经仔细检查了我的项目文件夹中图片的位置:</p>

<ul>
<li><p>资源/android/splash/*</p></li>
<li><p>资源/ios/icon/*</p></li>
<li><p>资源/ios/splash/*</p></li>
</ul>

<p>更重要的是,我覆盖了文件夹中的所有图像
平台\android\res
并将我的同名图像放在那里。没有运气。</p>

<p>我还尝试从 config.xml 中删除此标记:</p>

<pre><code>&lt;preference name=&#34;SplashScreen&#34; value=&#34;screen&#34; /&gt;
</code></pre>

<p>初始屏幕不是 Ionic 的默认设置,而是带有深色背景的空白屏幕(比我在应用程序中使用的黑色背景 #000 浅一点)</p>

<p>请帮忙!</p>

<p>附:我正在使用 Splashcreen 插件版本。 3.1.0
(<a href="http://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/index.html" rel="noreferrer noopener nofollow">http://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/index.html</a>)</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>将以下首选项添加到您的 config.xml:</p>

<pre><code>&lt;preference name=&#34;SplashScreen&#34; value=&#34;screen&#34;/&gt;
&lt;preference name=&#34;AutoHideSplashScreen&#34; value=&#34;true&#34;/&gt;
&lt;preference name=&#34;SplashShowOnlyFirstTime&#34; value=&#34;false&#34;/&gt;
&lt;preference name=&#34;ShowSplashScreenSpinner&#34; value=&#34;false&#34;/&gt;
&lt;preference name=&#34;FadeSplashScreen&#34; value=&#34;false&#34;/&gt;
&lt;preference name=&#34;SplashScreenDelay&#34; value=&#34;20000&#34;/&gt;
&lt;splash src=&#34;resources\splash.png&#34;/&gt;
</code></pre>

<p>使用此配置,启动画面适用于我(Ionic 2.3.0)。</p></p>
                                   
                                                <p style="font-size: 20px;">关于android - Cordova 闪屏未在 android 或 iOS 中加载,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/43230049/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/43230049/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: android - Cordova 闪屏未在 android 或 iOS 中加载