2016-04-20 43 views

回答

5

好吧我想通了,不得不手動編輯「/ plugins/cordova-plugin-splashscreen/src/ios」內的iOS插件文件「CDVSplashScreen.m」。

_activityView.center = CGPointMake(parentView.bounds.size.width/2, parentView.bounds.size.height/2 + 75); 

這樣做是否使得微調器從屏幕中心向下75像素。所以「+75」走向屏幕的底部「-75」會做相反的事情。

希望這可以幫助別人在那裏(但不是很難弄清楚)。

此外,如果你想改變微調的顏色。有3個選項可供選擇(不知道如何更改顏色)。

灰色(默認 - 搜索這一行):

UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray 

白色

UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite; 

whiteLarge

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

爲Android,類似的解決辦法是在

platforms/android/src/org/apache/cordova/splashscreen/SplashScreen.java

spinnerStart()變化Gravity值,RelativeLayout規則。

例如把微調底部:

變化

centeredLayout.setGravity(Gravity.CENTER);

centeredLayout.setGravity(Gravity.BOTTOM);

,改變

layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);

layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);

列表RelativeLayout的選擇:https://developer.android.com/reference/android/widget/RelativeLayout.html

的重力選項列表: https://developer.android.com/reference/android/view/Gravity.html

enter image description here

+0

感謝@馬特只需要iOS版本現在,但以後會派上用場!歡呼聲 – sputn1k

+0

Android:如果我只是想將它移動一點,該怎麼辦?我們可以給它的數值,我們在HTML中使用的方式40px等 –

+0

底部中心是什麼? –

0

我可以用不同的方式解決這個問題的Android,不幸的是馬特的解決方案沒有爲我工作。

所以我所做的就是在「spinnerStart」方法內部爲進度條使用本地填充方法。 如果有人對我的解決方案感興趣,我有兩個ios & android(sputn1k的解決方案也集成在屏幕的頂部)填充75%。 你可以叉子和進一步改善,這是你的需要,當你需要一個不同的填充

https://github.com/kaya18/cordova-plugin-splashscreen/

  final WindowManager win = (WindowManager)webView.getContext().getSystemService(Context.WINDOW_SERVICE); 
      final Display display = win.getDefaultDisplay(); 
      final Point size = new Point(); 
      display.getRealSize(size); 

      // add padding to (top) spinner 
      progressBar.setPadding(0, (size.y/2), 0, 0); 
      centeredLayout.addView(progressBar);