Change Color of Splash Screen Spinner in cordova-plugin-splashscreen

拥有回忆 提交于 2019-12-10 14:50:02

问题


I'm about to finish my first App with Ionic/Cordova.

YES it's GREAT, but sometimes I wonder why things are so complicated (with all those plugins and stuff :) )

I wonder if I can change the color of my Splash-Screen-Spinner.

Any Ideas? I search in die Source-Code: Color, Spinner....., but i didn't find a hint.

I think this would help so many people.

Greetings


回答1:


At least with Cordova 7.0 and Cordova iOS 4.4.0, there's no need to change the splash screen plugin's source code. You can just add the following line to your config.xml file and the spinner will appear as white instead of grey.

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

NOTE: The Apache Cordova documentation is a bit confusing when it comes to the spinner. The config.xml guide says the following about TopActivityIndicator:

Controls the appearance of the small spinning icon in the status bar that indicates significant processor activity.

I believe that statement refers to the following spinner:

However, at least on iOS as of Cordova 7.0, changing TopActivityIndicator affects the appearance of the spinner that appears in the middle of the screen while the app is opening. Here's an example of the whiteLarge setting:

Hope that helps.




回答2:


If you want to change the "cordova-plugin-splashscreen" Spinner colour on iOS. There are 3 predefined colour options to choose from (no idea how to change it to any colour). You have to manually edit the iOS plugin file "CDVSplashScreen.m" found inside "/plugins/cordova-plugin-splashscreen/src/ios".

gray (default - search for this line):

UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray

white

UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite; 

whiteLarge

UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge

Found in the files:

/*
 * 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
 *
 */

I also found a way to change the spinner position check out my stack post here




回答3:


SplashScreenSpinnerColor (string, defaults to system accent color): hash, rgb notation or CSS color name.

In your config.xml, you can add the following preferences:

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

You can also change SplashScreenBackgroundColor:

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

Refer this link for further.



来源:https://stackoverflow.com/questions/35943526/change-color-of-splash-screen-spinner-in-cordova-plugin-splashscreen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!