【发布时间】:2017-03-06 14:00:10
【问题描述】:
我正在尝试创建一个带有倒数计时器的平滑进度条。我希望计时器最多倒计时 20 秒。我正在使用下面的代码,但我无法实现进度条的平滑下降。倒计时刻度功能在进度条上运行良好,但在平滑行为的情况下则不行。我从我在项目中使用的 stackoverflow 中找到了以下代码,但你能告诉我我做错了什么吗?
if(android.os.Build.VERSION.SDK_INT >= 11){
// will update the "progress" propriety of seekbar until it reaches progress
ObjectAnimator animation = ObjectAnimator.ofInt(progressBarTimer, "progress", 0, 500);
animation.setDuration(20000); // 0.5 second
animation.setInterpolator(new LinearInterpolator());
animation.start();
}
else
progressBarTimer.setProgress(100);
【问题讨论】:
-
@RemeesMSyde 我正在使用自定义进度条
-
你能解决你的问题吗?我也有同样的情况。