1
2
4
5
8
9
12
13
16
17
20
21
24
25
28
29
32
33
36
37
40
41
44
45
48
49
layout文件
成都创新互联是一家专注于网站设计、网站制作与策划设计,阳西网站建设哪家好?成都创新互联做网站,专注于网站建设十载,网设计领域的专业建站公司;建站业务涵盖:阳西等地区。阳西做网站价格咨询:13518219792 1
2
6
7
12
13
19
20
Activity代码
1 package cn.itcast.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 DemoActivity extends Activity {
10 ImageView rocketImage;
11 AnimationDrawable animationDrawable;
12
13 @Override
14 public void onCreate(Bundle savedInstanceState) {
15 super.onCreate(savedInstanceState);
16 setContentView(R.layout.main);
17
18 rocketImage = (ImageView) findViewById(R.id.iv);
19 rocketImage.setBackgroundResource(R.drawable.anim);
20 animationDrawable = (AnimationDrawable) rocketImage.getBackground();
21 }
22
23 public void click(View view) {
24 animationDrawable.start();
25 }
26 }