Android examples for User Interface:View Rotate
rotate View Start
import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ArgbEvaluator; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.text.TextUtils; import android.view.View; import android.view.ViewPropertyAnimator; import android.view.animation.AccelerateInterpolator; import android.view.animation.LinearInterpolator; import android.widget.TextView; public class Main{ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static void rotateViewStart(final View view) { ViewPropertyAnimator viewPropertyAnimator = view.animate(); viewPropertyAnimator.setInterpolator(new LinearInterpolator()); viewPropertyAnimator.rotationBy(0.0f); viewPropertyAnimator.rotation(360.0f); viewPropertyAnimator.setDuration(720l); viewPropertyAnimator.withEndAction(new Runnable() { @Override// ww w . ja v a 2 s.co m public void run() { view.setRotation(0.0f); rotateViewStart(view); } }); viewPropertyAnimator.start(); } }