Code example for LayoutTransition

Methods: getDuration, setAnimator

0
                PropertyValuesHolder.ofFloat("scaleY",1f,0f,1f);
        final ObjectAnimator changeIn = 
                ObjectAnimator.ofPropertyValuesHolder(
                        this, pvhLeft, pvhTop, pvhRight
                        , pvhBottom, pvhScaleX, pvhScaleY);
        long duration = mTransitioner.getDuration(
                LayoutTransition.CHANGE_APPEARING);
        changeIn.setDuration(duration);
        mTransitioner.setAnimator(
                LayoutTransition.CHANGE_APPEARING, changeIn);
 
        Keyframe kf0 = Keyframe.ofFloat(0f, 0f);
        Keyframe kf1 = Keyframe.ofFloat(.9999f, 360f);
        Keyframe kf2 = Keyframe.ofFloat(1f, 0f);
        PropertyValuesHolder pvhRotation = PropertyValuesHolder
                .ofKeyframe("rotation", kf0, kf1, kf2);
        final ObjectAnimator changeOut = ObjectAnimator
                .ofPropertyValuesHolder(this, pvhLeft, pvhTop
                        , pvhRight, pvhBottom, pvhRotation);
        duration = mTransitioner.getDuration(
                LayoutTransition.CHANGE_DISAPPEARING);
        changeOut.setDuration(duration);
        mTransitioner.setAnimator(
                LayoutTransition.CHANGE_DISAPPEARING, changeOut);
 
        ObjectAnimator animIn = 
                ObjectAnimator.ofFloat(null,"rotationY",90f,0f);
        duration = mTransitioner.getDuration(
                LayoutTransition.APPEARING);
        animIn.setDuration(duration);
        mTransitioner.setAnimator(
                LayoutTransition.APPEARING, animIn);
 
        ObjectAnimator animOut = 
                ObjectAnimator.ofFloat(null,"rotationX",0f,90f);
        duration = mTransitioner.getDuration(
                LayoutTransition.DISAPPEARING);
        animOut.setDuration(duration);
        mTransitioner.setAnimator(
                LayoutTransition.DISAPPEARING, animOut);
         
        animOut.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator anim) {
                View view =