1. 程式人生 > >Android開發之Tween動畫實現方法

Android開發之Tween動畫實現方法

1,   Activity中實現 Animation的子類 

            Animation scaleAnimation = new ScaleAnimation(0f, 1f, 0f, 1f,
            Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
            scaleAnimation.setDuration(3000);

           view.startAnimation(scaleAnimation);

  2, xml 匯入

AnimationSet sets = new 
AnimationSet(true); ScaleAnimation scaleAnimation = (ScaleAnimation) AnimationUtils.loadAnimation(context,R.anim.scale_in); sets.addAnimation(scaleAnimation); view.setAnimation(sets);