Android examples for Animation:Rotate Animation
start Once 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 startOnceRotateAnimation(View v, float from, float to, long duration, Animation.AnimationListener listener) { RotateAnimation animation = new RotateAnimation(from, to, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(duration); animation.setRepeatCount(0);// w ww .j av a 2 s . c o m animation.setFillAfter(true); v.startAnimation(animation); } public static void startOnceRotateAnimation(View v, float from, float to, long duration) { RotateAnimation animation = new RotateAnimation(from, to, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(duration); animation.setRepeatCount(0); animation.setFillAfter(true); LinearInterpolator lir = new LinearInterpolator(); animation.setInterpolator(lir); v.startAnimation(animation); } }