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?

Foi útil?

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
scroll top