Question

I have a MapView with an ItemizedOverlay and a bunch of OverlayItem:s. When an OverlayItem is tapped on custom layout balloon is displayed on MapView. I can add a close button that hides the balloon layout. But how can I close the balloon if the user tap:s on the map outside the balloon? I have an OnTouchListener on the MapView, but how can I from this localize the open balloon layout and hide it?

/P

Was it helpful?

Solution

You could add a boolean property to your custom layout ballon called isOpen which you would set to true when the ballon gets opened and false when closed. If a user taps outside the ballon, in your onTouch event, iterate through your list of OverlayItems and check their isOpen property - if true, then close it and break out of the iteration loop.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top