问题
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