public static class GestureDetector.SimpleOnGestureListener
extends Object
implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener, GestureDetector.OnContextClickListener
java.lang.Object | |
↳ | android.view.GestureDetector.SimpleOnGestureListener |
一个便利的课程,当你只想听所有手势的一个子集时可以扩展。 这实现所有方法在GestureDetector.OnGestureListener
, GestureDetector.OnDoubleTapListener
,并GestureDetector.OnContextClickListener
但什么都不做,返回false
所有适用的方法。
Public constructors |
|
---|---|
GestureDetector.SimpleOnGestureListener() |
Public methods |
|
---|---|
boolean |
onContextClick(MotionEvent e) 发生上下文点击时通知。 |
boolean |
onDoubleTap(MotionEvent e) 发生双击时通知。 |
boolean |
onDoubleTapEvent(MotionEvent e) 当发生双击手势中的事件(包括向下,向上和向上事件)时通知。 |
boolean |
onDown(MotionEvent e) 当触发触发它的向下触发 |
boolean |
onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) 当它发生在 |
void |
onLongPress(MotionEvent e) 当长按发生时,通知 |
boolean |
onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) 当滚动发生时,通知通知 |
void |
onShowPress(MotionEvent e) 用户已经执行了一次下跌 |
boolean |
onSingleTapConfirmed(MotionEvent e) 单击时发出通知。 |
boolean |
onSingleTapUp(MotionEvent e) 当触发它的 |
Inherited methods |
|
---|---|
From class java.lang.Object
|
|
From interface android.view.GestureDetector.OnGestureListener
|
|
From interface android.view.GestureDetector.OnDoubleTapListener
|
|
From interface android.view.GestureDetector.OnContextClickListener
|
GestureDetector.SimpleOnGestureListener ()
boolean onContextClick (MotionEvent e)
发生上下文点击时通知。
Parameters | |
---|---|
e |
MotionEvent : The motion event that occurred during the context click. |
Returns | |
---|---|
boolean |
true if the event is consumed, else false |
boolean onDoubleTap (MotionEvent e)
发生双击时通知。
Parameters | |
---|---|
e |
MotionEvent : The down motion event of the first tap of the double-tap. |
Returns | |
---|---|
boolean |
true if the event is consumed, else false |
boolean onDoubleTapEvent (MotionEvent e)
当发生双击手势中的事件(包括向下,向上和向上事件)时通知。
Parameters | |
---|---|
e |
MotionEvent : The motion event that occurred during the double-tap gesture. |
Returns | |
---|---|
boolean |
true if the event is consumed, else false |
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
触发它。
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 onSingleTapConfirmed (MotionEvent e)
单击时发出通知。
与 onSingleTapUp(MotionEvent)
不同,只有在检测器确信用户的第一次敲击后没有第二次敲击导致双击手势后才会调用此功能。
Parameters | |
---|---|
e |
MotionEvent : The down motion event of the single-tap. |
Returns | |
---|---|
boolean |
true if the event is consumed, else false |
boolean onSingleTapUp (MotionEvent e)
MotionEvent
触发触发时会发出通知。
Parameters | |
---|---|
e |
MotionEvent : The up motion event that completed the first tap |
Returns | |
---|---|
boolean |
true if the event is consumed, else false |