Create zoom Animation - Android Animation

Android examples for Animation:Zoom Animation

Description

Create zoom Animation

Demo Code


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

public class Main {
    public static Animation zoomAnimation(float startScale, float endScale,
            long duration) {
        ScaleAnimation anim = new ScaleAnimation(startScale, endScale,
                startScale, endScale, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        anim.setFillAfter(true);/*from ww  w.  j  a  v  a2s .c  o m*/
        anim.setDuration(duration);
        return anim;
    }
}

Related Tutorials