I have 2 fragments that I want to swap between using a card flip animation.
Here is one of my animation files:
<?xml version="1.0" encoding="utf-8"?>
<set>
<!-- Rotate. -->
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:valueFrom="0"
android:valueTo="180"
android:propertyName="rotationY"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="@integer/card_flip_time_full" />
<!-- Half-way through the rotation (see startOffset), set the alpha to 0. -->
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:valueFrom="1.0"
android:valueTo="0.0"
android:propertyName="alpha"
android:startOffset="@integer/card_flip_time_half"
android:duration="1" />
</set>
I have 4 files like this. They are pretty much taken straight from this Google Demo. I have a minimum sdk of 8, so I am using the highly recommended Nine Old Androids library. However, I am still getting the following error: Uknown animation name: objectAnimator
. I can import the package for objectAnimator in my java files, so I am pretty certain I have everything configured properly with the JAR file. Earlier I set the objectAnimator
to translate
(and changed the attribute values) and it did do an animation, just not the more complicated one I am going for.
Does anyone have any advice on what I might be doing wrong? I am beginning to grasp at straws.
Edit: Just in case it helps, here is my flipCard function:
public void flipSalesCard(FragmentManager fm) {
if (salesShowingBack) {
salesShowingBack = false;
Fragment smallSSF = new SmallSalesSectionFragment();
FragmentTransaction trans = fm.beginTransaction();
trans.setCustomAnimations(R.anim.card_flip_left_in, R.anim.card_flip_left_out);
trans.replace(R.id.SalesInfoFragment, smallSSF);
trans.addToBackStack(null);
trans.commit();
return;
}
salesShowingBack = true;
Fragment expandedSSF = new ExpandedSalesSectionFragment();
FragmentTransaction trans = fm.beginTransaction();
trans.setCustomAnimations(R.anim.card_flip_right_in, R.anim.card_flip_right_out);
trans.replace(R.id.SalesInfoFragment, expandedSSF);
trans.addToBackStack(null);
trans.commit();
}