Animate to fade Out View - Android Animation

Android examples for Animation:Fade Animation

Description

Animate to fade Out View

Demo Code


//package com.java2s;
import android.content.Context;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

public class Main {
    public static Animation fadeOutView(Context context, long duration) {
        Animation a = animateView(context, android.R.anim.fade_out);
        a.setDuration(duration);//from w w w.  j  ava 2  s  . c o  m
        return a;
    }

    public static Animation animateView(Context context,
            int animationResource) {
        Animation a = AnimationUtils.loadAnimation(context,
                animationResource);
        return a;
    }
}

Related Tutorials