Android-frames-per-frame animation

Source: Internet
Author: User

In the process of time-consuming work, most will pop up a loaded box, there is a continuous rotation of the picture, often with a picture, using rotate to set the rotation, but looks not very beautiful, no image sense, Before 3.0, Android has two animation effects are motion tween and frame animation, with a picture of the use of motion tweens, defined to give two keyframes, through some algorithms to the given attribute value within a given time to the two key frame gradient.

Animation layout

<?XML version= "1.0" encoding= "Utf-8"?><animation-listxmlns:android= "Http://schemas.android.com/apk/res/android" >    <Itemandroid:drawable= "@drawable/appstore"android:duration= "$"/>    <Itemandroid:drawable= "@drawable/calculator"android:duration= "$"/>    <Itemandroid:drawable= "@drawable/camera"android:duration= "$"/>    <Itemandroid:drawable= "@drawable/clock"android:duration= "$"/>    <Itemandroid:drawable= "@drawable/compass"android:duration= "$"/>    <Itemandroid:drawable= "@drawable/contacts"android:duration= "$"/>    <Itemandroid:drawable= "@drawable/facetime"android:duration= "$"/>    <Itemandroid:drawable= "@drawable/game_center"android:duration= "$"/>    <Itemandroid:drawable= "@drawable/itunes_store"android:duration= "$"/>    <Itemandroid:drawable= "@drawable/mail"android:duration= "$"/></animation-list>

Code

 Public classMainactivityextendsActivity {PrivateImageView IV; Privateanimationdrawable ANI; @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);        Setcontentview (R.layout.activity_main); IV=(ImageView) Findviewbyid (R.ID.IV);        Iv.setbackgroundresource (r.drawable.ic_list); Ani=(animationdrawable) iv.getbackground (); }     Public voidClick (View view) {Ani.start (); }}

I'm the dividing line of the king of the Land Tiger.

Source code: HTTP://PAN.BAIDU.COM/S/1DD1QX01

Frame animations. zip

Reprint Please specify source: Http://www.cnblogs.com/yydcdut

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.