hide View Slide - Android Animation

Android examples for Animation:Animation to Hide

Description

hide View Slide

Demo Code


//package com.java2s;
import android.view.View;
import android.view.animation.AccelerateInterpolator;

public class Main {
    public static void hideViewSlide(View view, boolean toBottom) {
        if (view.getTag() == null)
            view.setTag(true);//from www  . java  2s .co m

        boolean isVisible = (boolean) view.getTag();
        if (isVisible) {
            view.setTag(false);
            if (toBottom)
                view.animate().translationY(view.getTop()).setDuration(200)
                        .setInterpolator(new AccelerateInterpolator())
                        .start();
            else
                view.animate().translationY(-view.getBottom())
                        .setDuration(200)
                        .setInterpolator(new AccelerateInterpolator())
                        .start();
        }
    }
}

Related Tutorials