双击时我需要缩放。为什么这不起作用?我工作了很长时间没有结果。没有识别触摸事件
public class MyMapActivity extends MapActivity implements OnGestureListener{
private MapView mapView;
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView)findViewById(R.id.mapView);
mGestureDetector = new GestureDetector(this,this);
detector.setOnDoubleTapListener(new OnDoubleTapListener(){
@Override
public boolean onDoubleTap(MotionEvent e) {
int x = (int)e.getX(), y = (int)e.getY();;
Projection p = map.getProjection();
map.getController().animateTo(p.fromPixels(x, y));
map.getController().zoomInFixing(x, y);
return false;
}
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
return false;
}
});
}
@Override
public boolean onTouchEvent(MotionEvent me) {
this.mGestureDetector.onTouchEvent(me);
return super.onTouchEvent(me);
}