circle Loading Animation - Android Animation

Android examples for Animation:Animation Creation

Description

circle Loading Animation

Demo Code


//package com.java2s;
import android.view.animation.Animation;

import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;

public class Main {
    public static RotateAnimation circleLoading(int duration) {
        RotateAnimation rotateAnimation = new RotateAnimation(0, +360,
                Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF,
                0);//w  w w .  j a  v  a  2 s. com
        rotateAnimation.setInterpolator(new LinearInterpolator());
        rotateAnimation.setDuration(duration);
        rotateAnimation.setRepeatMode(RotateAnimation.RESTART);
        rotateAnimation.setRepeatCount(-1);

        return rotateAnimation;
    }
}

Related Tutorials