Smooth Scrolling to next position
Is it possible to fix velocity so on scrolling, only items changes and position remain constant. Like moveToNextPos() & moveToPreviousPos();
I would appreciate a method for one by one smooth scrolling as well, any chance to see this in the future?
Hi, Use the below code for smooth scrolling on item select :
public void setSelected(final int rawPosition) { ValueAnimator valueAnimator = ValueAnimator.ofFloat(-1f * getAngleForPosition(mRawSelectedPosition), (-1f * getAngleForPosition(rawPosition))); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { setAngle((Float) valueAnimator.getAnimatedValue()); } }); valueAnimator.setDuration(2000);//animation duration valueAnimator.start(); }
It work for me. :)
Hi, Use the below code for smooth scrolling on item select :
public void setSelected(final int rawPosition) { ValueAnimator valueAnimator = ValueAnimator.ofFloat(-1f * getAngleForPosition(mRawSelectedPosition), (-1f * getAngleForPosition(rawPosition))); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @override public void onAnimationUpdate(ValueAnimator valueAnimator) { setAngle((Float) valueAnimator.getAnimatedValue()); } }); valueAnimator.setDuration(2000);//animation duration valueAnimator.start(); }
It work for me. :)
How to get RawPosition of on clicked item?