Android: HorizontalScrollView smoothScroll animation time

somin picture somin · Mar 4, 2011 · Viewed 42.9k times · Source

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.

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

So any ideas?

Thanks,

Si

Answer

Saikat picture Saikat · Jul 22, 2013

How About:

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