Android scroller fling
I hava a problem with a scroller.
@Override
public boolean onTouchEvent(MotionEvent ev) {
Log.d(TAG, "compute: " + mScroller.computeScrol开发者_StackOverflow中文版lOffset());
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!
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.
精彩评论