alpha Translate Animation - Android Animation

Android examples for Animation:Translate Animation

Description

alpha Translate Animation

Demo Code


//package com.java2s;
import android.content.Context;
import android.view.View;
import android.view.animation.AlphaAnimation;

import android.view.animation.AnimationSet;

import android.view.animation.TranslateAnimation;

public class Main {
    public static void alphaTranslate(View view, Context context) {
        view.setVisibility(View.VISIBLE);
        AnimationSet animationSet = new AnimationSet(context, null);
        TranslateAnimation translateAnimation = new TranslateAnimation(0,
                0, view.getHeight(), 0);
        AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
        animationSet.addAnimation(translateAnimation);
        animationSet.addAnimation(alphaAnimation);
        animationSet.setDuration(700);//from  www .  j  a  v  a  2s. c  o  m
        view.startAnimation(animationSet);
    }
}

Related Tutorials