Reduce speed of smooth scroll in scroll view

ShineDown picture ShineDown · Dec 27, 2011 · Viewed 48.8k times · Source

I have a scroll View. I performed smooth-scroll.using smoothScrollBy().It all works fine, but I want to change the duration of the smooth-scroll. Smooth-scroll happens very fast and user is not understanding what happened.Please help me reduce smooth-scroll speed?

Answer

365SplendidSuns picture 365SplendidSuns · Oct 8, 2015

The simple answer is just to replace

scrollView.smoothScrollTo(0, scrollTo);

with

ObjectAnimator.ofInt(scrollView, "scrollY",  scrollTo).setDuration(duration).start();

where duration is the time in milliseconds you want it to take.