animate View And Show - Android android.view.animation

Android examples for android.view.animation:Show Animation

Description

animate View And Show

Demo Code

import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

public class Main{

    public static void animateViewAndShow(final View viewToAnimate) {
        Animation anim = new AlphaAnimation(0, 1);
        anim.setDuration(200);/*from   w  w  w  . j  a va2  s .  c  om*/
        anim.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                viewToAnimate.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });

        viewToAnimate.startAnimation(anim);
    }

}

Related Tutorials