Close the balloon shown on MapView

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

/ P

+4
source share
1 answer

You can add the boolean property to your own layout coupon called isOpen, which you would set to true when the balloon is open and false when it closes. If the user goes beyond the balloon, in your onTouch event, iterate over your list of OverlayItems and check their isOpen property - if this is true, then close it and exit the iteration loop.

0
source

All Articles