Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the position of spinner with cordova

I have this in my config.xml

<preference name="show-splash-screen-spinner" value="true" /> 

And the spinner works great, however i need to change the position from center to something like center + 10% vertically

There is any way of doing this?

like image 925
user455318 Avatar asked Oct 11 '16 10:10

user455318


1 Answers

You have to fork the original cordova-plugin-splashscreen on github

Then on your config.xml you change it to use your fork, remove the original plugin (something like <plugin name="cordova-plugin-splashscreen" source="npm" />) and add your fork <plugin spec="https://github.com/youruser/cordova-plugin-splashscreen.git" />

You have to change this lines to do what you want https://github.com/apache/cordova-plugin-splashscreen/blob/master/src/android/SplashScreen.java#L355-L370

Right now it centers the dialog, I'm not really sure how to accomplish what you want, you'll have to figure out how Android layouts work

You can try to use setY as progressBar is a View subclass, something like this:

DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels;
float position = (float) (height*0.4);
progressBar.setY(position);
like image 140
jcesarmobile Avatar answered Oct 15 '22 10:10

jcesarmobile