Reputation: 441
I use view property animator as mentioned below, in android. It works well in most devices but in some it gives above mentioned error. It always fails in emulator as well. Having same issue with object animator as well. Note that animation works if applied on a single view, but not a container with multiple childs. Kindly help
wordViewPropertyAnimator.rotationYBy(-90f).setDuration(resources.getInteger(R.integer.rotateAnimationHalf))
.setListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
wordViewPropertyAnimator.setListener(null);
wordViewPropertyAnimator.rotationYBy(-180f).setDuration(0).start();
wordViewPropertyAnimator.rotationYBy(-90f).
setDuration(resources.getInteger(R.integer.rotateAnimationHalf)).start();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
})
.start();
ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(wordView,
View.ROTATION_Y, -90f);
objectAnimator.setDuration(200);
objectAnimator.start();
Upvotes: 1
Views: 745
Reputation: 606
I know yous asked a while ago and problem don't need this answer anymore but I hope to help someone in the future:
I was having the same problem, tried the objectAnimator on XML and tried also ViewPropertyAnimator to animate my view and both gave the same result, so the solution I found was to change the layout that was applying the animation, I was applying it to a cardView and I simply surrounded it with a FrameLayout and applied the animation into the group view and it worked just fine. I hope it helps somebody in the future.
Upvotes: 5
Reputation: 441
Looks like a platform issue, they need to fix it in future updates. Just use this library for now http://genzeb.github.io/flip
Upvotes: 0