Tween 静态动态加载

来源:互联网 发布:gps nema数据 编辑:程序博客网 时间:2024/06/14 12:32

Android Tween 动态加载 /静态加载 demo


静态加载


anim.xml

<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"><scale    android:duration="5000"    android:repeatCount="-1"    android:fromXScale="0.1"    android:fromYScale="0.1"    android:pivotX="50%"    android:pivotY="50%"    android:toXScale="3.0"    android:toYScale="3.0" /></set>---

activity

public class TweenActivityB extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.tween_st);    Animation animation = AnimationUtils.loadAnimation(this,R.anim.tween_st);    ImageView imageView = (ImageView) findViewById(R.id.image);    imageView.startAnimation(animation);    }}

动态加载

xml

public class TweenActivityA extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.tween_st);    Animation animation = new ScaleAnimation(0.1f,2.0f,0.1f,2.0f,Animation.RELATIVE_TO_PARENT,0.5f,Animation.RELATIVE_TO_SELF,0.5f);    animation.setRepeatCount(-1);    animation.setDuration(2000);    ImageView imageView = (ImageView)findViewById(R.id.image);    imageView.startAnimation(animation);    }}
0 0