frame动画

 

frame动画
 1 <?xml version="1.0" encoding="utf-8"?>

 2 <animation-list xmlns:android="http://schemas.android.com/apk/res/android"

 3     android:oneshot="false">

 4     <item android:drawable="@drawable/girl_1" android:duration="100" />

 5     <item android:drawable="@drawable/girl_2" android:duration="100" />

 6     <item android:drawable="@drawable/girl_3" android:duration="100" />

 7     <item android:drawable="@drawable/girl_4" android:duration="100" />

 8     <item android:drawable="@drawable/girl_5" android:duration="100" />

 9     <item android:drawable="@drawable/girl_6" android:duration="200" />

10     <item android:drawable="@drawable/girl_7" android:duration="300" />

11     <item android:drawable="@drawable/girl_8" android:duration="200" />

12     <item android:drawable="@drawable/girl_9" android:duration="100" />

13     <item android:drawable="@drawable/girl_10" android:duration="100" />

14     <item android:drawable="@drawable/girl_11" android:duration="100" />

15 </animation-list>
View Code

 

 

 

 1 package com.itheima.frame;

 2 

 3 import android.app.Activity;

 4 import android.graphics.drawable.AnimationDrawable;

 5 import android.os.Bundle;

 6 import android.view.View;

 7 import android.widget.ImageView;

 8 

 9 public class MainActivity extends Activity {

10 

11     private ImageView iv;

12     private AnimationDrawable ad;

13 

14     @Override

15     protected void onCreate(Bundle savedInstanceState) {

16         super.onCreate(savedInstanceState);

17         setContentView(R.layout.activity_main);

18 

19         iv = (ImageView) findViewById(R.id.iv);

20         iv.setImageResource(R.anim.frame);

21         ad = (AnimationDrawable) iv.getDrawable();

22     }

23 

24     public void start(View v) {

25         if (ad.isRunning())

26             ad.stop();

27         ad.start();

28     }

29 

30 }

 

你可能感兴趣的:(frame)