OnTouch in MapView only fires the first time

后端 未结 6 886
没有蜡笔的小新
没有蜡笔的小新 2020-12-17 02:04

I\'m trying to implement a double-tap zoom like function in my MapView. The event always fires the first time, but never subsequent times. Below is my code. I have a feeling

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-17 02:41

    If you are using this method "mapView.setBuiltInZoomControls(true);" then your touch is working at once .

    Please remove that that line and check I am sure it will work..

    In some case if you want BuiltInZoomControls then you can you OnTouch method of Overlay like as below..

    public class MapOverlay extends Overlay {
    
        public MapOverlay(Context ctx) {super(ctx);}
    
        @Override
        protected void draw(Canvas c, MapView osmv, boolean shadow) { }
    
        @Override
        public boolean onTouchEvent(MotionEvent e, MapView mapView) {
            //Write yout touch code here..
            return false;
        }
    }
    

提交回复
热议问题