安卓:Horizo​​ntalScrollView smoothScroll动画时间时间、动画、Horizo、ntalScrollView

2023-09-12 07:05:30 作者:史莱姆

我有一种情况,我使用与图像的水平滚动视图并使用按钮来平滑滚动到不同的图像位置。现在,它的工作原理好吧,我只是想知道是否有人知道反正减缓平滑滚动的方法,即具有较长annimation时间?作为目前捕捉迅速发生pretty的。

I have a situation in that I am using a horizontal scroll view with images and using buttons to smooth scroll to the different image locations. Now it works okay I was just wondering if anyone knew of anyway to slow down the smooth scroll method, i.e. having a longer annimation time? As currently the snapping happens pretty quickly.

也许通过smoothscroll的重写,我试图寻找这/例子,但没有运气。

Perhaps through an override of the smoothscroll, I have tried to search for this/examples but to no luck.

因此​​,任何想法?

谢谢

推荐答案

怎么样:

ObjectAnimator animator=ObjectAnimator.ofInt(yourHorizontalScrollView, "scrollX",targetXScroll );
animator.setDuration(800);
animator.start();