How to detect flip animation

I want to make flip as an animation of my ImageView after I click on it. My intention is to reduce the width of the image to 0 and immediately expand it to 1.0. This should simulate a flip image.

This is what I really have. After clicking on the image, it reduces the image from 1.0 to 0.

My question is how to continue expanding part of the animation?

<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"> <scale android:interpolator="@android:anim/linear_interpolator" android:fromXScale="1.0" android:toXScale="0.0" android:fromYScale="1.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="200" /> </set> 

EDIT

I added another block for the back of the animation, but it does not work properly. It seems that startOffset is not valid or something like that. In other words, the animation is confused, it seems that the first part of the animation also affects this part of the code. What am I doing wrong?

 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"> <scale android:interpolator="@android:anim/linear_interpolator" android:fromXScale="1.0" android:toXScale="0.0" android:fromYScale="1.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="200" /> <set android:startOffset="200"> <scale android:interpolator="@android:anim/linear_interpolator" android:fromXScale="0.0" android:toXScale="1.0" android:fromYScale="1.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="200" /> </set> </set> 
+4
source share
2 answers

After the next R&D, I found that this piece of code does exactly what I want to do.

 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <scale android:fromXScale="1.0" android:toXScale="0.0" android:fromYScale="1.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="200" android:repeatCount="2" android:repeatMode="reverse"/> </set> 

This means that I added repeatMode and repeatCount to the definition of the ant animation, this works the way I expected.

+1
source

Bury another <set> <scale /> </set> inside your first set, but after the initial scale. This will make them shoot sequentially.

See this page for an example. http://developer.android.com/guide/topics/graphics/view-animation.html

+1
source

All Articles