Animate to fade In View - Android Animation

Android examples for Animation:Fade Animation

Description

Animate to fade In 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 fadeInView(Context context, long duration) {
        Animation a = animateView(context, android.R.anim.fade_in);
        a.setDuration(duration);/*from  w  w  w.  j a  va  2s . c o  m*/
        return a;
    }

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

Related Tutorials