public static interface GestureDetector.OnGestureListener
android.view.GestureDetector.OnGestureListener |
Known Indirect Subclasses |
用于手势发生时通知的侦听器。 如果你想听所有不同的手势然后实现这个接口。 如果你只想听一个子集,可以更容易地扩展GestureDetector.SimpleOnGestureListener
。
Public methods |
|
---|---|
abstract boolean |
onDown(MotionEvent e) 当触发触发它的向下触发 |
abstract boolean |
onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) 当它发生在 |
abstract void |
onLongPress(MotionEvent e) 当发生长 |
abstract boolean |
onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) 当滚动发生时,通知通知 |
abstract void |
onShowPress(MotionEvent e) 用户已经执行了一次下跌 |
abstract boolean |
onSingleTapUp(MotionEvent e)
|
boolean onDown (MotionEvent e)
当触发触发它的向下MotionEvent
发生触击时通知。 这将在每次下降事件时立即触发。 所有其他事件应该在此之前。
Parameters | |
---|---|
e |
MotionEvent : The down motion event. |
Returns | |
---|---|
boolean |
boolean onFling (MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
当它发生在MotionEvent
和匹配MotionEvent
的初始状态时,就会通知它。 计算出的速度沿x和y轴以像素/秒为单位提供。
Parameters | |
---|---|
e1 |
MotionEvent : The first down motion event that started the fling. |
e2 |
MotionEvent : The move motion event that triggered the current onFling. |
velocityX |
float : The velocity of this fling measured in pixels per second along the x axis. |
velocityY |
float : The velocity of this fling measured in pixels per second along the y axis. |
Returns | |
---|---|
boolean |
true if the event is consumed, else false |
void onLongPress (MotionEvent e)
当发生长 MotionEvent
,通知 MotionEvent
触发它。
Parameters | |
---|---|
e |
MotionEvent : The initial on down motion event that started the longpress. |
boolean onScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
通过向下滚动MotionEvent
和当前移动MotionEvent
发生滚动时通知。 x和y的距离也是为了方便而提供的。
Parameters | |
---|---|
e1 |
MotionEvent : The first down motion event that started the scrolling. |
e2 |
MotionEvent : The move motion event that triggered the current onScroll. |
distanceX |
float : The distance along the X axis that has been scrolled since the last call to onScroll. This is NOT the distance between e1 and e2 . |
distanceY |
float : The distance along the Y axis that has been scrolled since the last call to onScroll. This is NOT the distance between e1 and e2 . |
Returns | |
---|---|
boolean |
true if the event is consumed, else false |
void onShowPress (MotionEvent e)
用户已经执行了一次下跌MotionEvent
并且没有执行任何操作。 此事件通常用于向用户提供视觉反馈,让他们知道他们的行为已被识别,即突出显示一个元素。
Parameters | |
---|---|
e |
MotionEvent : The down motion event |
boolean onSingleTapUp (MotionEvent e)
在触发它的 MotionEvent
上 MotionEvent
时发出通知。
Parameters | |
---|---|
e |
MotionEvent : The up motion event that completed the first tap |
Returns | |
---|---|
boolean |
true if the event is consumed, else false |