AI-generated Key Takeaways
-
GoogleMap.InfoWindowAdapterallows customization of info windows displayed for markers on a Google Map. -
It offers two methods:
getInfoWindow()to customize the entire info window andgetInfoContents()to customize only the content within the default frame. -
If
getInfoWindow()returns a view, it's used for the whole info window; if it returnsnull, the default frame is used with content fromgetInfoContents(). -
Changes to views returned by these methods after they're called might not be reflected in the displayed info window.
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.