9

In the new Google Maps for Android API v2, I can very easily get custom markers and info windows to display. However, I'm trying to have multiple buttons inside of my info window, that each perform a different onClick action but the problem is, the map treats the InfoWindow as it's own button object (no matter where I click on the InfoWindow, it presses the entire thing). Does anyone know how to customize this a bit more?

RyanInBinary
  • 1,533
  • 3
  • 19
  • 47

1 Answers1

20

Just found this in the documentation.

As mentioned in the previous section on info windows, an info window is not a live View, rather the view is rendered as an image onto the map. As a result, any listeners you set on the view are disregarded and you cannot distinguish between click events on various parts of the view. You are advised not to place interactive components — such as buttons, checkboxes, or text inputs — within your custom info window.

Unfortunately, that answers it. I was trying to add the same function as you.

StuStirling
  • 15,601
  • 23
  • 93
  • 150
  • 2
    Thank you for this. I was trying to convince my project manager that this is now the case, and couldn't find anywhere in the documentation that explicitly mentioned it. I should be able to show him this now and have the functionality reworked moving forward. – RyanInBinary Dec 13 '12 at 13:07
  • Here you will find it: https://developers.google.com/maps/documentation/android/marker – Helton Isac Apr 09 '13 at 11:54
  • 1
    Related documentation moved to https://developers.google.com/maps/documentation/android-sdk/infowindows – togikan May 25 '19 at 18:40