alpha In Out Animation - Android Animation

Android examples for Animation:Alpha Fly Animation

Description

alpha In Out Animation

Demo Code


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

import android.view.animation.AnimationSet;

public class Main {
    public static void alphaInOut(View view, Context context) {
        AnimationSet animationSet = new AnimationSet(context, null);
        AlphaAnimation fadeIn = new AlphaAnimation(0.5f, 1f);
        AlphaAnimation fadeOut = new AlphaAnimation(1f, 0f);
        animationSet.addAnimation(fadeIn);
        animationSet.addAnimation(fadeOut);
        animationSet.setDuration(1000);/*from w  w  w.j ava2  s.com*/
        view.startAnimation(animationSet);
    }
}

Related Tutorials