How to close popup only when clicked on mapview and not drag or pinch in android
-
27-10-2019 - |
Pergunta
I am working in Android 2.2. I have overlays on my MapView, each overlay market gets a popup window when clicked on.
I want to close the popup window when the MapView is tapped/clicked, but the normal code for doing this in the OnTouch event also closes it when it's dragged or pinched.
How do I handle a drag or pinch in the Ontouch event?
Solução
The problem here is, you're using the single-touch API, with Android 2.0+ you have the capabilities to use their multi-touch API.
You basically have to use the MotionEvent parameter in an overridden onTouch method, to get the exact motion, and then handle your code accordingly, based off event.
Here's a decent blog entry with a tutorial:
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow