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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论