I am trying to do:
ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out);
But I am getting an exception with Unknown animation name: objectAnimator - see details below:
04-08 10:45:41.637: ERROR/AndroidRuntime(1222): FATAL EXCEPTION: main
04-08 10:45:41.637: ERROR/AndroidRuntime(1222): java.lang.RuntimeException: Unknown animation name: objectAnimator
04-08 10:45:41.637: ERROR/AndroidRuntime(1222): at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:124)
04-08 10:45:41.637: ERROR/AndroidRuntime(1222): at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:91)
04-08 10:45:41.637: ERROR/AndroidRuntime(1222): at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:72)
Why is there an error? I am not sure how to solve it. Please Help. Thanks.
FYI: My min sdk is 7, but I am build for sdk 11 with compatibility library.
You have to target 3.0 (API level 11) to use the new object animator. If you are building for lower versions you must use the older anim transitions (android.R.anim).
However, I think that fragment animations in the compat library are broken as stated by Dianne Hackborn in this post.
I forked the support library to add support for using NineOldAndroids animators in custom fragment transitions. Note that they only work with CustomTransition and not via theme settings. Object animators must be used as View animations will no longer work. android_frameworks_support
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With