hide view with translation animation - Android android.view.animation

Android examples for android.view.animation:Hide Animation

Description

hide view with translation animation

Demo Code

import android.view.View;

public class Main {

  public static void hide(View view) {
    if (view.getVisibility() == View.GONE)
      return;/*from   w ww.  j  a va2  s.  co m*/

    view.setVisibility(View.VISIBLE);
    view.animate().translationY(view.getHeight() * 2f).alpha(0f).withEndAction(() -> view.setVisibility(View.GONE))
        .start();
  }

}

Related Tutorials