Animates the specified view From Bottom To Top - Android User Interface

Android examples for User Interface:View Translate

Description

Animates the specified view From Bottom To Top

Demo Code


//package com.java2s;

import android.view.View;
import android.view.animation.AccelerateInterpolator;

import android.view.animation.Animation;

import android.view.animation.ScaleAnimation;

public class Main {
    /**//from   w w  w.j av a2 s.  co  m
     * Animates the specified view
     * 
     * @param v
     *            the view to animate
     */
    public static void animateFromBottomToTop(View v) {
        if (v.getVisibility() != View.VISIBLE) {
            v.setVisibility(View.VISIBLE);

            ScaleAnimation animation = new ScaleAnimation(1, 1, 0, 1,
                    Animation.RELATIVE_TO_SELF, Animation.RELATIVE_TO_SELF,
                    Animation.RELATIVE_TO_SELF, 1);
            animation.setFillAfter(false);
            animation.setDuration(500);
            animation.setInterpolator(new AccelerateInterpolator());

            v.startAnimation(animation);
        }
    }
}

Related Tutorials