Smooth Progress Bar Animation

前端 未结 9 840
鱼传尺愫
鱼传尺愫 2021-01-01 10:34

I\'m trying to implement a smooth animation for my ProgressBar, but when I increase the time (30 seconds), the animation is no longer smooth.

Example wi

9条回答
  •  死守一世寂寞
    2021-01-01 10:40

    If you have Android N and above, you can use :

    progressBar.setProgress(newProgress, true)
    

    Docs:

    Sets the current progress to the specified value, optionally animating the visual position between the current and target values.

    Animation does not affect the result of getProgress(), which will return the target value immediately after this method is called.

    https://developer.android.com/reference/android/widget/ProgressBar.html#setProgress(int,%20boolean)

提交回复
热议问题