show View with translation animation - Android android.view.animation

Android examples for android.view.animation:Show Animation

Description

show View with translation animation

Demo Code

import android.view.View;

public class Main{

    public static void show(View view) {
        if (view.getVisibility() == View.VISIBLE)
            return;

        view.setVisibility(View.VISIBLE);
        view.setAlpha(0f);//from ww  w.  jav  a  2  s .c  o  m
        view.setTranslationY(view.getHeight() * 2f);
        view.animate().translationY(0f).alpha(1f).start();
    }

}

Related Tutorials