Android: How to detect when a scroll has ended

后端 未结 14 800
误落风尘
误落风尘 2020-11-27 10:54

I am using the onScroll method of GestureDetector.SimpleOnGestureListener to scroll a large bitmap on a canvas. When the scroll has ended I want to redraw the bitmap in case

相关标签:
14条回答
  • 2020-11-27 11:53

    Extract from the onScroll event from GestureListener API: link text

    public abstract boolean onScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) Since: API Level 1

    Returns * true if the event is consumed, else false

    Perhaps once the event has been consumed, the action is finished and the user has taken their finger off the screen or at the least finished this onScroll action

    You can then use this in an IF statement to scan for == true and then commence with the next action.

    0 讨论(0)
  • 2020-11-27 11:54

    My attempt at adding additional functionality to gesture detector. Hope it helps someone put his time to better use...

    https://gist.github.com/WildOrangutan/043807ddbd68978179b7cea3b53c71e8

    0 讨论(0)
提交回复
热议问题