Android examples for Animation:Rotate Animation
start Repeat Self Rotate Animation
//package com.java2s; import android.view.View; import android.view.animation.Animation; import android.view.animation.LinearInterpolator; import android.view.animation.RotateAnimation; public class Main { public static void startRepeatSelfRotateAnimation(View v, long duration, Animation.AnimationListener listener) { RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(duration); animation.setRepeatCount(-1);//from w ww .j av a 2 s . c o m animation.setFillAfter(true); animation.setRepeatMode(Animation.INFINITE); // LinearInterpolator lir = new LinearInterpolator(); animation.setInterpolator(lir); if (listener != null) { animation.setAnimationListener(listener); } v.startAnimation(animation); } }