Android Hybrid Animation
In Android development, we will often use animation, but a simple animation (such as rotation, zoom, gradient, displacement, etc.) sometimes does not meet the requirements of our project, this time need to apply to the hybrid animation, then in the Andong is how to achieve a cool hybrid animation, Here is one way to implement a hybrid animation:
1, first of all, in the Res directory to establish a Anim file, in Anim to establish a hybrid.xml file as follows:
<?xml version= "1.0" encoding= "Utf-8"?> <set xmlns:android= "Http://schemas.android.com/apk/res/android" > <!--displacement animation--> <translate android:duration= "1000" android:fromxdelta= "0" Android:fromyde Lta= "0" android:toxdelta= "android:toydelta="/> <!--zoom animation--> <scale Android :d uration= "1000" android:fillafter= "true" android:fromxscale= "0.0" android:fromyscale= "0.0" android:pi votx= "50%" android:pivoty= "50%" android:startoffset= "1000" android:toxscale= "1.0" android:toyscale= "1". 0 "/> <!--gradient animation--> <alpha android:duration=" 1000 "android:fromalpha=" 0.1 "Android:star
toffset= "android:toalpha=" "1.0"/> <!--rotary animation--> <rotate "1000" android:fromdegrees= "0" android:startoffset= "3000" android:pivotx= "50%" android:pivoty= "50%" Android: todegrees= "359"/> </seT>
2, loading animation:
Load mixed animation
Animation Animation = Animationutils.loadanimation (this, r.anim.hybrid);
Imageview1.startanimation (animation)//Start animation
Of course, the above is just an example, we can modify the Hybrid.xml configuration file to modify the performance of the animation to achieve the effect we need.
Thank you for reading, I hope to help you, thank you for your support for this site!