Java tutorial
//package com.java2s; //License from project: Apache License import android.animation.Animator; import android.animation.ObjectAnimator; import android.view.View; public class Main { public static Animator getAlphaAnimator(View view) { return getAlphaAnimator(view, false); } public static Animator getAlphaAnimator(View view, boolean hideView) { float start = hideView ? 1 : 0; float end = hideView ? 0 : 1; view.setAlpha(start); ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.ALPHA, start, end); animator.setDuration(200); return animator; } }