android 旋轉動畫一直轉,不卡頓

一直轉的旋轉動畫中間有停頓的只要原因是,旋轉動畫的旋轉速度不是一直不變的,是有加速過程的,所以解決這個問題就可以讓旋轉動畫一直轉,不停頓:


rotateAnimation = new RotateAnimation(0,360,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
        rotateAnimation.setDuration(300);
        rotateAnimation.setFillAfter(true);
        rotateAnimation.setRepeatMode(Animation.RESTART);
        //讓旋轉動畫一直轉,不停頓的重點
        rotateAnimation.setInterpolator(new LinearInterpolator());
        rotateAnimation.setRepeatCount(-1);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章