set Rotate Animation to a View - Android Animation

Android examples for Animation:Rotate Animation

Description

set Rotate Animation to a View

Demo Code


//package com.java2s;
import android.content.Context;
import android.view.View;

import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;

public class Main {

    public static void setRotateAnimation(final View v, Context contect,
            int animId) {
        Animation operatingAnim = AnimationUtils.loadAnimation(contect,
                animId);/*from  w  ww  .ja  v  a 2s.c o  m*/
        LinearInterpolator lin = new LinearInterpolator();
        operatingAnim.setInterpolator(lin);
        operatingAnim.setFillAfter(true);
        v.startAnimation(operatingAnim);
    }
}

Related Tutorials