Android同時播放縮放動畫和位移動畫

Animation mScaleAnimation = new ScaleAnimation(0.5f, 1.0f, 0.5f,
                1.0f,// 整個屏幕就0.0到1.0的大小//縮放
                Animation.INFINITE, 0.5f,
                Animation.INFINITE, 0.5f);
        mScaleAnimation.setDuration(1000);
        mScaleAnimation.setFillAfter(true);

        Animation mTranslateAnimation = new TranslateAnimation(-100*SetRobot2Activity.mDensity,0, -15*SetRobot2Activity.mDensity, 0);// 移動
        mTranslateAnimation.setDuration(1000);
        AnimationSet mAnimationSet=new AnimationSet(false);
        mAnimationSet.addAnimation(mScaleAnimation);
        mAnimationSet.setFillAfter(true);
        mAnimationSet.addAnimation(mTranslateAnimation);
        iv.startAnimation(mAnimationSet);

 

 

摘自 liuxiIT的專欄

發佈留言