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