2016-05-10 20 views
0

FrameLayoutImageViewが1つあり、回転アニメーションが適用されています。ただし、アニメーションは有効ではありません。FrameLayoutのImageViewにアニメーションを回転させても効果がありません

res/animにあります)、アニメーションリソースファイルanim_blog.xml:Activity

<set xmlns:android="http://schemas.android.com/apk/res/android" 
     android:interpolator="@android:anim/linear_interpolator" > 

    <rotate 
     android:fromDegrees="0.0" 
     android:toDegrees="360.0" 
     android:pivotX="50%p" 
     android:pivotY="50%p" 
     android:repeatCount="infinite" 
     android:duration="1200" /> 
</set> 

コードは以下の通りである:

Animation rotateAnim = AnimationUtils.loadAnimation(mCtx, R.anim.anim_blog); 
rotateAnim.setDuration(Integer.MAX_VALUE); 
mProgressIV.startAnimation(rotateAnim); 
+0

xmlを追加し、このコードスニペットをどこに書いていますか? – KDeogharkar

+0

コードは、アクティビティのonResume()メソッドで記述されます。 –

答えて

2

あなたのようにそれを変更し、大きすぎるアニメーションの再生時間を設定しています次のとおりです。

Animation rotateAnim = AnimationUtils.loadAnimation(mCtx, R.anim.anim_blog); 
mProgressIV.startAnimation(rotateAnim); 
+3

値が大きすぎると、ミリ秒を表します - 私のポケット電卓は、1回転がほぼ25日かかると言います:) – 0X0nosugar

0

suを行ってください間違いなく私の最後から:

ImageView image = (ImageView)findViewById(R.id.imageView); 
    Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.anim_blog); 
    image.startAnimation(animation); 

私は例hereを作成しました。あなたはそれをチェックアウトすることができます。

関連する問題