一、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);//設置動畫作用的目標對象