Java tutorial
//package com.java2s; //License from project: Apache License import android.animation.Animator; import android.animation.ObjectAnimator; import android.support.annotation.NonNull; import android.view.View; public class Main { /** * Fade Animation * @param view View to be animated * @param fromAlpha initial alpha * @param toAlpha final alpha * @param duration animation duration in milliseconds * @return Animator Object */ @NonNull public static Animator fade(@NonNull final View view, float fromAlpha, float toAlpha, int duration) { ObjectAnimator animator = ObjectAnimator.ofFloat(view, "alpha", fromAlpha, toAlpha); animator.setDuration(duration); return animator; } }