android maps: How to Long Click a Map?

后端 未结 8 1801
遥遥无期
遥遥无期 2020-12-02 12:41

How do I long click on a mapview so that a place marker appears at that point on the map?

I tried a couple ways without success:

1) Using setOnLongCl

8条回答
  •  时光取名叫无心
    2020-12-02 12:59

    This mapview-overlay-manager library is super. The reason onLongPress gets triggered when 'scrolling' is because the library does not take into account multitouch. You can work around this by rejecting onLongPress if there is more than one pointer involved as so:

    public void onLongPress(MotionEvent motionEvent, ManagedOverlay arg1) {
    
        if (motionEvent.getPointerCount() > 1) return;
    
        ... your logic here ...
    }
    

提交回复
热议问题