quick Add Event Show Animation - Android Animation

Android examples for Animation:Animation to Show

Description

quick Add Event Show Animation

Demo Code


//package com.java2s;

import android.view.animation.AccelerateInterpolator;

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

import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;

public class Main {
    private final static long QUICK_ADD_ANIMATION_DURATION = 500;

    static public Animation quickAddEventShow(float yValue) {

        AnimationSet animationSet = new AnimationSet(true);

        ScaleAnimation scale = new ScaleAnimation(1.0f, 1.0f, 0.125f, 1.0f); // HERE
        scale.setDuration(QUICK_ADD_ANIMATION_DURATION);
        scale.setInterpolator(new AccelerateInterpolator());
        animationSet.addAnimation(scale);

        TranslateAnimation a = new TranslateAnimation(
                Animation.RELATIVE_TO_PARENT, 0.0f,
                Animation.RELATIVE_TO_PARENT, 0.0f,

                Animation.ABSOLUTE, yValue, Animation.RELATIVE_TO_PARENT,
                0.0f);//from  w  w  w.j a  v  a  2 s.  c o m
        a.setDuration(QUICK_ADD_ANIMATION_DURATION);
        a.setInterpolator(new AccelerateInterpolator());
        animationSet.addAnimation(a);

        return animationSet;

    }
}

Related Tutorials