mapView双击事件监测

public class MyMapView extends MapView {

  private long lastTouchTime = -1;

  public MyMapView(Context context, AttributeSet attrs) {

    super(context, attrs);
  }

  @Override
  public boolean onInterceptTouchEvent(MotionEvent ev) {

    if (ev.getAction() == MotionEvent.ACTION_DOWN) {

      long thisTime = System.currentTimeMillis();
      if (thisTime - lastTouchTime < 250) {

        // Double tap
        this.getController().zoomInFixing((int) ev.getX(), (int) ev.getY());
        lastTouchTime = -1;

      } else {

        // Too slow
        lastTouchTime = thisTime;
      }
    }

    return super.onInterceptTouchEvent(ev);
  }

你可能感兴趣的:(MapView)