Code example for LayoutTransition

Methods: getDuration, setAnimator

0
		 
		 
		 
		//Adding 
		ObjectAnimator animIn = ObjectAnimator.ofFloat(null, "rotationY", 90f,0f)
				.setDuration(mTransition.getDuration(LayoutTransition.APPEARING));
		 
		mTransition.setAnimator(LayoutTransition.APPEARING, animIn);
		 
		animIn.addListener(new AnimatorListenerAdapter() {
			@Override 
			public void onAnimationEnd(Animator animation) {
				super.onAnimationEnd(animation);
				View view = (View)((ObjectAnimator)animation).getTarget();
				view.setRotationY(0f);
			} 
		}); 
		 
		 
		// Changing while Removing 
//        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). 
//                setDuration(mTransition.getDuration(LayoutTransition.CHANGE_DISAPPEARING)); 
//        mTransition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING, changeOut); 
//        changeOut.addListener(new AnimatorListenerAdapter() { 
//            public void onAnimationEnd(Animator anim) { 
//                View view = (View) ((ObjectAnimator) anim).getTarget(); 
//                view.setRotation(0f); 
//            } 
//        }); 
		 
		// Removing 
        ObjectAnimator animOut = ObjectAnimator.ofFloat(null, "rotationX", 0f, 90f).
                setDuration(mTransition.getDuration(LayoutTransition.DISAPPEARING));
        mTransition.setAnimator(LayoutTransition.DISAPPEARING, animOut);
        animOut.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator anim) {
                View view = (View) ((ObjectAnimator) anim).getTarget();
                view.setRotationX(0f);
            }