Most visited

Recently visited

Added in API level 1

GestureDetector.OnGestureListener

public static interface GestureDetector.OnGestureListener

android.view.GestureDetector.OnGestureListener
Known Indirect Subclasses


用于手势发生时通知的侦听器。 如果你想听所有不同的手势然后实现这个接口。 如果你只想听一个子集,可以更容易地扩展GestureDetector.SimpleOnGestureListener

Summary

Public methods

abstract boolean onDown(MotionEvent e)

当触发触发它的向下触发 MotionEvent时发出通知。

abstract boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)

当它发生在 MotionEvent和匹配 MotionEvent的初始状态时,会通知它。

abstract void onLongPress(MotionEvent e)

当发生长 MotionEvent ,通过触发 MotionEvent的初始状态 MotionEvent

abstract boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)

当滚动发生时,通知通知 MotionEvent和当前移动 MotionEvent

abstract void onShowPress(MotionEvent e)

用户已经执行了一次下跌 MotionEvent并且没有执行任何操作。

abstract boolean onSingleTapUp(MotionEvent e)

MotionEvent触发时发生轻敲时通知。

Public methods

onDown

Added in API level 1
boolean onDown (MotionEvent e)

当触发触发它的向下MotionEvent发生触击时通知。 这将在每次下降事件时立即触发。 所有其他事件应该在此之前。

Parameters
e MotionEvent: The down motion event.
Returns
boolean

onFling

Added in API level 1
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

onLongPress

Added in API level 1
void onLongPress (MotionEvent e)

当发生长 MotionEvent ,通知 MotionEvent触发它。

Parameters
e MotionEvent: The initial on down motion event that started the longpress.

onScroll

Added in API level 1
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

onShowPress

Added in API level 1
void onShowPress (MotionEvent e)

用户已经执行了一次下跌MotionEvent并且没有执行任何操作。 此事件通常用于向用户提供视觉反馈,让他们知道他们的行为已被识别,即突出显示一个元素。

Parameters
e MotionEvent: The down motion event

onSingleTapUp

Added in API level 1
boolean onSingleTapUp (MotionEvent e)

在触发它的 MotionEventMotionEvent时发出通知。

Parameters
e MotionEvent: The up motion event that completed the first tap
Returns
boolean true if the event is consumed, else false

Hooray!