【问题标题】:navigator.splashscreen.hide() not working on cordova-android@11.0.0navigator.splashscreen.hide() 在 cordova-android@11.0.0 上不起作用
【发布时间】:2022-11-06 21:14:15
【问题描述】:

我刚刚升级到针对 API 31 的 cordova-android@11.0.0。这需要替换我之前构建的启动屏幕插件。我使用AutoHideSplashScreen = false,以便在呈现 UI 后隐藏启动画面。这在 iOS 上运行良好,但启动画面在 Android 上永远存在,尽管调用了navigator.splashscreen.hide()(即使使用调试器)。这发生在 API 31 和旧设备上。我暂时采用了自动隐藏和长时间的淡入淡出,以使某些东西起作用。我尝试了几种不同的 config.xml 变体,所以我不确定将一个放在这里是否有用,但对于所有这些变体,Android 上的AutoHideSplashScreen = false 不起作用。

【问题讨论】:

    标签: android cordova splash-screen android-splashscreen


    【解决方案1】:

    您需要在 config.xml 中进行设置

     <preference name="AutoHideSplashScreen" value="false" />
    

    【讨论】:

    【解决方案2】:

    您将不得不在您的 平台androidppsrcmain esalues hemes.xml 文件

    这就是我的样子

     <?xml version='1.0' encoding='utf-8'?>
    <resources>
        <style name="Theme.App.SplashScreen" parent="Theme.SplashScreen.IconBackground">
            <item name="windowSplashScreenBackground">@color/cdv_splashscreen_background</item>
            <item name="windowSplashScreenAnimatedIcon">@drawable/ic_cdv_splashscreen</item>
            <item name="windowSplashScreenAnimationDuration">200</item>
            <item name="android:windowIsTranslucent">true</item>
            <item name="postSplashScreenTheme">@style/Theme.AppCompat.NoActionBar</item>
        </style>
        <style name="MyTheme" parent="android:Theme.Holo.Light">
        </style>
    

    请只考虑闪屏部分

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-08
      • 2014-06-29
      • 2019-12-07
      相关资源
      最近更新 更多