enable Animation Transition - Android Animation

Android examples for Animation:Translate Animation

Description

enable Animation Transition

Demo Code


//package com.java2s;
import android.animation.LayoutTransition;
import android.annotation.TargetApi;
import android.os.Build;
import android.view.ViewGroup;

public class Main {
    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public static void enableAnimationTransition(Object view) {
        if (view instanceof ViewGroup && Build.VERSION.SDK_INT > 10) {
            LayoutTransition transition = new LayoutTransition();
            transition.setAnimator(LayoutTransition.CHANGE_APPEARING, null);
            transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
                    null);/* www.  j  av a2  s .  c om*/
            ViewGroup viewGroup = (ViewGroup) view;
            viewGroup.setLayoutTransition(transition);
        }
    }
}

Related Tutorials