Create animation to Fade In - Android android.view.animation

Android examples for android.view.animation:Fade Animation

Description

Create animation to Fade In

Demo Code

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.os.Build;
import android.view.View;
import android.view.ViewPropertyAnimator;

public class Main {

  @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
  public static void animFadeIn(final View view) {
    ViewPropertyAnimator viewPropertyAnimator = view.animate();
    viewPropertyAnimator.alpha(1f);/*from  ww w  .jav a2s. co m*/
    viewPropertyAnimator.setDuration(300l);
    view.setVisibility(View.VISIBLE);
    viewPropertyAnimator.start();

    viewPropertyAnimator.setListener(new AnimatorListenerAdapter() {
      @Override
      public void onAnimationEnd(Animator animation) {

      }
    });
  }

}

Related Tutorials