代码改变世界

android 手势编程

2012-02-12 00:24  cjzhang  阅读(280)  评论(0编辑  收藏  举报

GestureDetector

  

     interface          GestureDetector.OnDoubleTapListener

  interface          GestureDetector.OnGestureListener  在有手势动作发生时,通知的监听器

  class               GestureDetector.SimpleOnGestureListener  当只需要监听部分手势时,用于扩展的便捷类

 

public boolean isLongpressEnabled ()                          如果允许长按事件,则返回true,否则为false

public boolean onTouchEvent (MotionEvent ev)           

public void setIsLongpressEnabled (boolean isLongpressEnabled)

public void setOnDoubleTapListener (GestureDetector.OnDoubleTapListeneronDoubleTapListener

GestureDetector.OnGestureListener


Public Methods
abstract boolean onDown(MotionEvent e)
Notified when a tap occurs with the down MotionEvent that triggered it.
abstract boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
Notified of a fling event when it occurs with the initial on down MotionEvent and the matching up MotionEvent.
abstract void onLongPress(MotionEvent e)
Notified when a long press occurs with the initial on down MotionEvent that trigged it.
abstract boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
Notified when a scroll occurs with the initial on down MotionEvent and the current move MotionEvent.
abstract void onShowPress(MotionEvent e)
The user has performed a down MotionEvent and not performed a move or up yet.
abstract boolean onSingleTapUp(MotionEvent e)
Notified when a tap occurs with the up MotionEvent that triggered it.