2012-03-13 22 views
0

これはxmlの私のアニメーションです。アンドロイド:pivotX = "50%"で試してみましたが、やはり私が望むものは得られません。回転のポイントは間違っています。緑色の線を画面の中央付近で回転させたい。xmlの回転アニメーションは中央で回転しません

<?xml version="1.0" encoding="utf-8"?> 
<rotate xmlns:android="http://schemas.android.com/apk/res/android" 
    android:fromDegrees="0" android:interpolator="@android:anim/linear_interpolator" 
    android:toDegrees="360" android:pivotX="0%" android:pivotY="0%" 
    android:repeatCount="5" 
    android:duration="5000" android:startOffset="0" /> 

は、私はこのようなアニメーションを作りたい: enter image description here 緑の線が回転しなければならない、と回転点は、画面の中央にする必要があります。これどうやってするの ?

+0

それはあなたの現在の症状が何であるかは不明だが、それはこの問題に関連されることがあります。http://code.google.com/p/android/issues/detail?id=22969 – CommonsWare

+2

@Lukapはいけません'android:pivotX'と' android:pivotY'を '' 50% ''に設定してください – Selvin

答えて

-2

回転中心点を画像の中心に設定してRotateAnimationを使用します。

RotateAnimation anim = new RotateAnimation(0f, 350f, 15f, 15f); 
anim.setInterpolator(new LinearInterpolator()); 
anim.setRepeatCount(Animation.INFINITE); 
anim.setDuration(700); 

// Start animating the image 
final ImageView splash = (ImageView) findViewById(R.id.splash); 
splash.startAnimation(anim); 

// Later.. stop the animation 
splash.setAnimation(null); 
関連する問題