2016-04-20 3 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 = UIActivityIndicatorViewStyleWhiteLarge 

UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite; 

whiteLarge

UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray 

白ファイルで発見:Android用

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

、同様の修正がGravity値、およびRelativeLayoutルールを変更spinnerStart()

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

です。

下部にスピナーを置くために:

変更

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

リスト:私は、別の方法でAndroidのためにマットから、残念ながら解決策をこの問題を解決することができ https://developer.android.com/reference/android/view/Gravity.html

enter image description here

+0

おかげでそれを改善することができます!歓声 – sputn1k

+0

Android:ほんの少し上に移動したいのですが?数値でも、HTMLで使用する方法でもかまいません。 40pxなど –

+0

ボトムセンターはどうですか? –

0

私のために働かなかった。

私がしたことは、「spinnerStart」メソッド内のプログレスバーにネイティブPaddingメソッドを使用することでした。 誰かが私のソリューションに興味があれば、私は&アンドロイド(sputn1kのソリューションも統合されています)の画面の上から75%パディングしています。 あなたはフォークと、さらに別のパディングを必要とするとき、あなたのニーズに合わせて今だけのためのiOSバージョンを必要ですが、それは後で便利になるだろう@matt

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); 
関連する問題