开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜