码迷,mamicode.com
首页 > 其他好文 > 详细

帧动画 连续播放多张图片动画 以及ui动画 SoundPool

时间:2015-09-23 13:33:20      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:

drawable下有很多图片  可以

技术分享
 1 <?xml version="1.0" encoding="utf-8"?>
 2 <animation-list android:oneshot="false"
 3   xmlns:android="http://schemas.android.com/apk/res/android">
 4     <item android:duration="20" android:drawable="@drawable/waiting_001" />
 5     <item android:duration="20" android:drawable="@drawable/waiting_002" />
 6     <item android:duration="20" android:drawable="@drawable/waiting_003" />
 7     <item android:duration="20" android:drawable="@drawable/waiting_004" />
 8     <item android:duration="20" android:drawable="@drawable/waiting_005" />
 9     <item android:duration="20" android:drawable="@drawable/waiting_006" />
10     <item android:duration="20" android:drawable="@drawable/waiting_007" />
11     <item android:duration="20" android:drawable="@drawable/waiting_008" />
12     <item android:duration="20" android:drawable="@drawable/waiting_009" />
13     <item android:duration="20" android:drawable="@drawable/waiting_010" />
14     <item android:duration="20" android:drawable="@drawable/waiting_011" />
15     <item android:duration="20" android:drawable="@drawable/waiting_012" />
16     <item android:duration="20" android:drawable="@drawable/waiting_013" />
17     <item android:duration="20" android:drawable="@drawable/waiting_014" />
18     <item android:duration="20" android:drawable="@drawable/waiting_015" />
19     <item android:duration="20" android:drawable="@drawable/waiting_016" />
20     <item android:duration="20" android:drawable="@drawable/waiting_017" />
21     <item android:duration="20" android:drawable="@drawable/waiting_018" />
22     <item android:duration="20" android:drawable="@drawable/waiting_019" />
23     <item android:duration="20" android:drawable="@drawable/waiting_020" />
24     <item android:duration="20" android:drawable="@drawable/waiting_021" />
25     <item android:duration="20" android:drawable="@drawable/waiting_022" />
26     <item android:duration="20" android:drawable="@drawable/waiting_023" />
27     <item android:duration="20" android:drawable="@drawable/waiting_024" />
28     <item android:duration="20" android:drawable="@drawable/waiting_025" />
29     <item android:duration="20" android:drawable="@drawable/waiting_026" />
30     <item android:duration="20" android:drawable="@drawable/waiting_027" />
31     <item android:duration="20" android:drawable="@drawable/waiting_028" />
32     <item android:duration="20" android:drawable="@drawable/waiting_029" />
33     <item android:duration="20" android:drawable="@drawable/waiting_030" />
34     <item android:duration="20" android:drawable="@drawable/waiting_031" />
35     <item android:duration="20" android:drawable="@drawable/waiting_032" />
36     <item android:duration="20" android:drawable="@drawable/waiting_033" />
37     <item android:duration="20" android:drawable="@drawable/waiting_034" />
38     <item android:duration="20" android:drawable="@drawable/waiting_035" />
39     <item android:duration="20" android:drawable="@drawable/waiting_036" />
40     <item android:duration="20" android:drawable="@drawable/waiting_037" />
41     <item android:duration="20" android:drawable="@drawable/waiting_038" />
42     <item android:duration="20" android:drawable="@drawable/waiting_039" />
43     <item android:duration="20" android:drawable="@drawable/waiting_040" />
44     <item android:duration="20" android:drawable="@drawable/waiting_041" />
45     <item android:duration="20" android:drawable="@drawable/waiting_042" />
46     <item android:duration="20" android:drawable="@drawable/waiting_043" />
47     <item android:duration="20" android:drawable="@drawable/waiting_044" />
48     <item android:duration="20" android:drawable="@drawable/waiting_045" />
49     <item android:duration="20" android:drawable="@drawable/waiting_046" />
50     <item android:duration="20" android:drawable="@drawable/waiting_047" />
51     <item android:duration="20" android:drawable="@drawable/waiting_048" />
52     <item android:duration="20" android:drawable="@drawable/waiting_049" />
53     <item android:duration="20" android:drawable="@drawable/waiting_050" />
54     <item android:duration="20" android:drawable="@drawable/waiting_051" />
55     <item android:duration="20" android:drawable="@drawable/waiting_052" />
56     <item android:duration="20" android:drawable="@drawable/waiting_053" />
57     <item android:duration="20" android:drawable="@drawable/waiting_054" />
58     <item android:duration="20" android:drawable="@drawable/waiting_055" />
59     <item android:duration="20" android:drawable="@drawable/waiting_056" />
60     <item android:duration="20" android:drawable="@drawable/waiting_057" />
61     <item android:duration="20" android:drawable="@drawable/waiting_058" />
62     <item android:duration="20" android:drawable="@drawable/waiting_059" />
63     <item android:duration="20" android:drawable="@drawable/waiting_060" />
64     <item android:duration="20" android:drawable="@drawable/waiting_061" />
65     <item android:duration="20" android:drawable="@drawable/waiting_062" />
66     <item android:duration="20" android:drawable="@drawable/waiting_063" />
67     <item android:duration="20" android:drawable="@drawable/waiting_064" />
68     <item android:duration="20" android:drawable="@drawable/waiting_065" />
69 </animation-list>
animation_loading.xml

 

组成帧动画 

技术分享
 1 package com.example.animation1;
 2 
 3 import android.app.Activity;
 4 import android.graphics.drawable.AnimationDrawable;
 5 import android.os.Bundle;
 6 import android.view.Menu;
 7 import android.view.animation.Animation;
 8 import android.widget.ImageView;
 9 
10 public class MainActivity extends Activity {
11 
12     private ImageView iv;
13     @Override
14     protected void onCreate(Bundle savedInstanceState) {
15         super.onCreate(savedInstanceState);
16         setContentView(R.layout.activity_main);
17         
18         iv=(ImageView) findViewById(R.id.iv);
19         AnimationDrawable anim=(AnimationDrawable) iv.getBackground();
20         anim.start();
21     }
22 
23 }
MainActivity.java

 

 

 

ui动画   pivotX  pivotY  pivotX     属性为动画相对于物件的X坐标的开始位置

 

anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);

  Animation alpha,ping,xuan,suof;

alpha=AnimationUtils.loadAnimation(this, R.layout.toumingdu);

ping=AnimationUtils.loadAnimation(this, R.layout.pingyi);
xuan=AnimationUtils.loadAnimation(this, R.layout.xuanzhuan);
suof=AnimationUtils.loadAnimation(this, R.layout.scale);

tv1.startAnimation(alpha);
tv2.startAnimation(ping);
tv3.startAnimation(xuan);
tv4.startAnimation(suof);

 

 

 

 

SoundPool soundpool2;

soundpool2=new SoundPool(5,AudioManager.STREAM_SYSTEM, 0);
soundmap.put(1, soundpool2.load(this, R.raw.anjian, 1));

  soundpool2.play(soundmap.get(1), 1,1,0,0,1);

 

帧动画 连续播放多张图片动画 以及ui动画 SoundPool

标签:

原文地址:http://www.cnblogs.com/bimingcong/p/4831857.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!