Android Hybrid animation detailed and implementation code _android

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.