Create Bigger And Disappear Animation - Android Animation

Android examples for Animation:Animation to Hide

Description

Create Bigger And Disappear Animation

Demo Code


//package com.java2s;

import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;

import android.view.animation.ScaleAnimation;

public class Main {
    public static Animation getBiggerAndDisappear(int duration) {
        AnimationSet as = new AnimationSet(true);
        Animation scale_animation = new ScaleAnimation(1.0f, 4.0f, 1.0f,
                4.0f, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        Animation alpha_animation = new AlphaAnimation(1, 0);
        as.addAnimation(scale_animation);
        as.addAnimation(alpha_animation);
        as.setDuration(duration);//from ww  w. j av  a 2s. co m
        as.setFillAfter(true);
        return as;
    }
}

Related Tutorials