AI-generated Key Takeaways
-
GoogleMap.InfoWindowAdapter provides views for customized rendering of info windows for markers.
-
Methods on this adapter are called when an info window needs to be shown, regardless of whether it's triggered by a user gesture or a programmatic call.
-
To replace the default info window, implement
getInfoWindow(Marker)and return null fromgetInfoContents(Marker). -
To replace only the contents inside the default info window, implement
getInfoContents(Marker)and return null fromgetInfoWindow(Marker). -
The adapter includes two main methods:
getInfoContentsfor custom content within the default frame andgetInfoWindowfor a completely custom info window view.
Provides views for customized rendering of info windows.
Methods on this provider are called when it is time to show an info window for a marker,
regardless of the cause (either a user gesture or a programmatic call to Marker.showInfoWindow().
Since there is only one info window shown at any one time, this provider may choose to reuse
views, or it may choose to create new views on each method invocation.
When constructing an info window, methods in this class are called in a defined order. To
replace the default info window, override
getInfoWindow(Marker) with your custom rendering and return null for
getInfoContents(Marker). To replace only the info window contents inside the
default info window frame (the callout bubble), return null in
getInfoWindow(Marker) and override
getInfoContents(Marker) instead.
Developer Guide
For more information, read the Info Windows developer guide.
Public Method Summary
| abstract View |
getInfoContents(Marker
marker)
Provides custom contents for the default info window frame of a marker.
|
| abstract View |
Public Methods
public abstract View getInfoContents (Marker marker)
Provides custom contents for the default info window frame of a marker. This method
is only called if
getInfoWindow(Marker) first returns null. If this method
returns a view, it will be placed inside the default info window frame. If you change
this view after this method is called, those changes will not necessarily be reflected
in the rendered info window. If this method returns null, the default
rendering will be used instead.
Parameters
| marker | The marker for which an info window is being populated. |
|---|
Returns
- A custom view to display as contents in the info window for
marker, or null to use the default content rendering instead.
public abstract View getInfoWindow (Marker marker)
Provides a custom info window for a marker. If this method returns a view, it is
used for the entire info window. If you change this view after this method is called,
those changes will not necessarily be reflected in the rendered info window. If this
method returns null , the default info window frame will be used, with
contents provided by
getInfoContents(Marker).
Parameters
| marker | The marker for which an info window is being populated. |
|---|
Returns
- A custom info window for
marker, ornullto use the default info window frame withcustom contents.