2016-07-27 67 views
0

我已經實現了一個循環進度條,它在10秒鐘內完成填充。不過,我認爲吧檯開始時會更快速地填滿,因此,隨着時間的推移它會變慢(動畫充滿)。另外,最後,它停下來,然後終於結束。 How to Create a circular progressbar in Android which rotates on it?Android循環進度條在進度上變慢

然後我的代碼,啓動進度條是::

ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar); 
ObjectAnimator animation = ObjectAnimator.ofInt (progressBar, "progress", 0, 100); 
animation.setDuration (10000); 
animation.setInterpolator (new DecelerateInterpolator()); 
animation.start(); 

我怎樣才能使動畫更流暢我使用的代碼,我從第一個答案在這裏得到了什麼?

+0

可能這將有助於 [鏈接](https://github.com/Pedramrn/CircularProgressBar) –

+0

看起來這將是一個很大更多的代碼來實現我已經有了。我想如果它更順暢,它會更好,但我想知道爲什麼我的這個問題。 – Jill

+1

它因爲DecelerateInterpolator。改用LinearInterpolator。 – dudego

回答

3

這是因爲您使用的是DecelerateInterpolator。內插器定義動畫的變化率。這可以使基本動畫效果加速,減速,重複等。

您可以閱讀更多關於插值器here的信息。

您可以使用LinearInterpolatorAccelerateInterpolator,以達到您的目的爲準。