使用定义在xml下的动画

一、Drawable Animation

<animation-list>为根元素,以<item>表示要轮换显示的图片,duration属性表示各项显示的时间。
XML文件要放在/res/drawable/目录下
anim = (AnimationDrawable) imageView.getBackground();   

anim.stop();   anim.start();


二、Tweene

 res文件夹下建立anim文件夹
ser-<set>
alpha-<alpha>
scale-<scale>
....
Animation animation = AnimationUtils.loadAnimation(context, R.anim.xx);


三、属性动画

在XML声明中所使用的对应的XML标签:
ValueAnimator- <animator>
ObjectAnimator- <objectAnimator>
AnimatorSet- <set>
ObjectAnimator scaleAnimator = (ObjectAnimator) AnimatorInflater.loadAnimator(this, R.animator.scale_object_animator);  scaleAnimator.setTarget(imageview_scale);//设置动画作用的目标对象


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章