You can use this as a pattern, here is an animator object.
<?xml version="1.0" encoding="utf-8"?> <objectAnimator xmlns:android="http://schemas.android.com/apk/res/android" android:propertyName="rotationY" android:valueFrom="0" android:valueTo="360" > </objectAnimator>
I noticed that in some tutorial only valueTo is indicated. This will allow you to flip only once, since your view is already 360, it will no longer flip, so always use valueFrom. And here is the code that will flip any view:
public static void flip(Context context, View view) { ObjectAnimator anim = (ObjectAnimator) AnimatorInflater.loadAnimator( context, R.animator.flip); anim.setTarget(view); anim.setDuration(1000); anim.end(); anim.start(); }
Milan source share