【问题标题】:Change Color of Splash Screen Spinner in cordova-plugin-splashscreen在 cordova-plugin-splashscreen 中更改启动画面微调器的颜色
【发布时间】:2016-03-11 15:05:42
【问题描述】:

我即将使用 Ionic/Cordova 完成我的第一个应用程序。

是的,这很棒,但有时我想知道为什么事情如此复杂(有所有这些插件和东西:))

我想知道是否可以更改 Splash-Screen-Spinner 的颜色

有什么想法吗?我在源代码中搜索:颜色,微调器.....,但我没有找到提示。

我认为这会帮助很多人。

问候

【问题讨论】:

标签: cordova ionic-framework cordova-plugins splash-screen


【解决方案1】:

至少在 Cordova 7.0 和 Cordova iOS 4.4.0 中,不需要更改闪屏插件的源代码。您只需将以下行添加到您的 config.xml 文件中,微调器将显示为白色而不是灰色。

<preference name="TopActivityIndicator" value="whiteLarge" />

注意:当谈到微调器时,Apache Cordova 文档有点混乱。 config.xml 指南对 TopActivityIndicator 进行了以下说明:

控制状态栏中指示重要处理器活动的小旋转图标的外观。

我认为该声明指的是以下微调器:

但是,至少在 Cordova 7.0 的 iOS 上,更改 TopActivityIndicator 会影响应用打开时出现在屏幕中间的微调器的外观。这是whiteLarge 设置的示例:

希望对您有所帮助。

【讨论】:

    【解决方案2】:

    如果您想更改 iOS 上的“cordova-plugin-splashscreen”微调器颜色。有 3 种预定义的颜色选项可供选择(不知道如何将其更改为任何颜色)。您必须手动编辑“/plugins/cordova-plugin-splashscreen/src/ios”中的 iOS 插件文件“CDVSplashScreen.m”。

    灰色(默认 - 搜索此行):

    UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray
    

    白色

    UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite; 
    

    白色大号

    UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge
    

    在文件中找到:

    /*
     * The Activity View is the top spinning throbber in the status/battery bar. We init it with the default Grey Style.
     *
     *     whiteLarge = UIActivityIndicatorViewStyleWhiteLarge
     *     white      = UIActivityIndicatorViewStyleWhite
     *     gray       = UIActivityIndicatorViewStyleGray
     *
     */
    

    我还找到了改变微调器位置的方法,请查看我的stack post here

    【讨论】:

    • 更改这条线对我不起作用。微调器仍然是灰色的。它对某人有用吗?
    • @Clemorphy 绝对有效。忙于使用此代码 ATM 没有问题。
    • 您是否只更改了此文件的第 84 行? github.com/apache/cordova-plugin-splashscreen/blob/master/src/… 因为那对我没有任何改变...
    • @Clemorphy 是的(以及我配置中的其他内容)。但是你确定你在插件中加载正确吗?
    【解决方案3】:

    SplashScreenSpinnerColor(字符串,默认为系统强调色): 哈希、RGB 符号或 CSS 颜色名称。

    在您的config.xml 中,您可以添加以下首选项:

    <preference name="SplashScreenSpinnerColor" value="white" />
    

    你也可以改SplashScreenBackgroundColor:

    <preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF"/>
    

    更多信息请参考this链接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多