地图View双击事件监测

mapView双击事件监测public class MyMapView extends MapView {? private long lastTouchTime -1? publ

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 地图View双击事件监测
??????? lastTouchTime = thisTime;
????? }
??? }

??? return super.onInterceptTouchEvent(ev);
? }