1. 程式人生 > >Android——Animation筆記:檢視動畫

Android——Animation筆記:檢視動畫

一:簡單的檢視動畫

透明度、旋轉、移動、縮放和動畫集合
----

**
        int duration = 1000;
        AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
        alphaAnimation.setDuration(duration);
        bn.startAnimation(alphaAnimation);

        RotateAnimation rotateAnimation = new RotateAnimation(0,360);
        rotateAnimation.setDuration
(duration); bn1.startAnimation(rotateAnimation); TranslateAnimation translateAnimation = new TranslateAnimation(0,200,0,300); translateAnimation.setDuration(duration); translateAnimation.setFillAfter(true); bn2.startAnimation(translateAnimation); ScaleAnimation scaleAnimation = new ScaleAnimation(0
,1,0,1); scaleAnimation.setDuration(duration); bn3.startAnimation(scaleAnimation); AnimationSet animationSet = new AnimationSet(true); animationSet.setDuration(duration); animationSet.addAnimation(alphaAnimation); animationSet.addAnimation(translateAnimation);
animationSet.addAnimation(scaleAnimation); bn4.startAnimation(animationSet);

侷限性:只改變顯示,無法響應事件