1

I hava a problem with a scroller.

    @Override
public boolean onTouchEvent(MotionEvent ev) {
    Log.d(TAG, "compute: " + mScroller.computeScrollOffset());
    mScroller.fling(0, 0, 0, 1000, 0, 0, 0, 2000);
    invalidate();
    ...

But i can't see any fling effect on touch, what am I doing wrong? Thanks!

user638289
  • 11
  • 3

1 Answers1

2

You simply need to call mScroller.computeScrollOffset() directly before you access the current x and y values with mScroller.getCurrX/Y(). The scroller doesn't scroll a view itself, it just provides the values you manually need to apply.

m1ntf4n
  • 493
  • 2
  • 14