animation Scale - Android Animation

Android examples for Animation:Scale Animation

Description

animation Scale

Demo Code


//package com.java2s;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;

public class Main {
    public static void animationScale(View paramView) {
        animation(paramView, new ScaleAnimation(0.0F, 1.0F, 0.0F, 1.0F, 2,
                0.5F, 2, 0.5F), 1000L, 0L);
    }/*ww  w  .  jav  a 2  s  .  c  o  m*/

    public static void animationScale(View paramView, long paramLong,
            Animation.AnimationListener paramAnimationListener) {
        ScaleAnimation localScaleAnimation = new ScaleAnimation(0.0F, 1.0F,
                0.0F, 1.0F, 1, 0.5F, 1, 0.5F);
        localScaleAnimation.setAnimationListener(paramAnimationListener);
        animation(paramView, localScaleAnimation, paramLong, 0L);
    }

    private static void animation(View paramView, Animation paramAnimation,
            long paramLong1, long paramLong2) {
        paramAnimation.setDuration(paramLong1);
        paramAnimation.setStartOffset(paramLong2);
        paramView.setVisibility(0);
        paramView.startAnimation(paramAnimation);
    }

    public static void animation(View paramView) {
        TranslateAnimation localTranslateAnimation = new TranslateAnimation(
                2, 1.0F, 2, 0.0F, 2, 0.0F, 2, 0.0F);
        AlphaAnimation localAlphaAnimation = new AlphaAnimation(0.0F, 1.0F);
        AnimationSet localAnimationSet = new AnimationSet(false);
        localAnimationSet.addAnimation(localTranslateAnimation);
        localAnimationSet.addAnimation(localAlphaAnimation);
        animation(paramView, localAnimationSet, 1000L, 0L);
    }
}

Related Tutorials