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?
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.
Try the following code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {     ValueAnimator realSmoothScrollAnimation =          ValueAnimator.ofInt(parentScrollView.getScrollY(), targetScrollY);     realSmoothScrollAnimation.setDuration(500);     realSmoothScrollAnimation.addUpdateListener(new AnimatorUpdateListener()     {         @Override         public void onAnimationUpdate(ValueAnimator animation)         {             int scrollTo = (Integer) animation.getAnimatedValue();             parentScrollView.scrollTo(0, scrollTo);         }     });      realSmoothScrollAnimation.start(); } else {     parentScrollView.smoothScrollTo(0, targetScrollY); } 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With