start Softly Show Animation - Android Animation

Android examples for Animation:Animation to Show

Description

start Softly Show Animation

Demo Code


import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.view.View;
import android.view.animation.DecelerateInterpolator;

public class Main{
    public static void startSoftlyShowAnimation(final View view,
            final int duration, final OnAnimtaionEndListener listener) {
        view.animate().alpha(0.5f).scaleX(0.85f).scaleY(0.85f)
                .setDuration(0)//from   w w  w.j  a  v  a 2  s.  c o m
                .setListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animation) {

                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        view.animate().scaleX(1f).scaleY(1f).alpha(1f)
                                .setDuration(duration).setListener(null);
                        if (listener != null) {
                            listener.onAnimationEnd();
                        }
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {

                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {

                    }
                }).start();
    }
}

Related Tutorials