问题描述
我有一个屏幕,4条寻求(如下图所示)。如果用户移动B,C或D I计算三者的平均值和setProgress A与平均值。这是比较容易的部分。我想这样做的是动画进度条,使得它不会在一杆(25-75来自于EG)跳。
I have a screen with 4 seek bars ( As shown in the image below) . If the user moves B,C or D I calculate the average of the three and setProgress of A to the average. That was the easy part . What I would like to do is animate the progress bar A such that it does not jump in one shot (for eg from 25-75 ).
什么是推荐的方式来动态显示?我有一个简单的动画了,但我打电话以单位值一个TimerTask每50ms递增或递减,直到我达到所要求的位置。但它的效率不高。
What are the recommended ways to animate A? I got a simple animation up but I am calling a TimerTask every 50ms to increment or decrement A by a unit value till I reach the required position. But its not very efficient.
请注意:我有一个自定义的使用,我已经创建了搜索栏是一个搜索栏对象,B,C和; D.对不起,我真的不能共享code,但会很乐意澄清任何事情。
Note: I have a custom Seekbar object using which I have created seekBar's A,B,C & D. Sorry I cant really share the code but will be happy to clarify anything.
推荐答案
我通过在一个指数函数来代替单位增量迭代计时器任务减少迭代的次数。仍然希望更好的答案: - )
I reduced the number of iterations by iterating the timer task over an exponential function instead of unit increments. Still hoping for better answers :-)
这篇关于动画搜索栏进度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!