4

I am using a custom layout to be displayed as Infowindow when clicked on map marker in android.

enter image description here

In the above picture, when I clcik on EditText to enter the name, I did observe that Edit Text is not being edited and the Whole window is getting selected. How to make the fields clickable in an infowindow when custom layout is used?

Please suggest me any Idea. Please Help!!

Kara
  • 6,115
  • 16
  • 50
  • 57
Mahe
  • 2,707
  • 13
  • 50
  • 69
  • This is old, but check [this](http://stackoverflow.com/questions/14123243/google-maps-android-api-v2-interactive-infowindow-like-in-original-android-go) thread out. –  Jun 25 '16 at 08:38
  • Did you get the same result? I also want to type message In Info window with edit text – Jasmin Sojitra Apr 20 '22 at 10:47

1 Answers1

9

The quick answer: you can't.

Google Map renders the content of you custom InfoWindow into an image and displays it to you as an Image. Therefore you set a click Listener only to the whole window and not to the Views inside it.

Your only choice it to set the ClickListener to the whole InfoWindow and popup an Dialog with the EditText View you want, and not do it directly inside the InfoWindow.

From Google Docs: https://developers.google.com/maps/documentation/android/marker#info_windows

Note: The info window that is drawn is not a live view. The view is rendered as an image (using View.draw(Canvas)) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (e.g., after an image has loaded), call showInfoWindow(). Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.

Emil Adz
  • 40,709
  • 36
  • 140
  • 187