开发者

Close balloon showed on MapView

开发者 https://www.devze.com 2023-01-29 18:47 出处:网络
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 l

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 OnT开发者_JAVA技巧ouchListener on the MapView, but how can I from this localize the open balloon layout and hide it?

/P


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号