Expanding markers with information windows
Information windows are used to display additional information on a map, such as text and images. The information windows are supported by markers. Normally, information windows are displayed when a marker is tapped.
Note
You can display only one information window at a time. When another marker is clicked on, the current window is hidden and other windows pop up.
The following image is an example of an information window:
The information box that is displayed above the marker is the information window. The text that is displayed in bold is called a Title and the text that is displayed below the title is the called a Snippet.
How to add an information window?
An information window can be added by calling the title()
and snippet()
method on the MarkerOptions()
object, which takes a string as an argument.
The following code makes this possible. We have predefined the LatLng
values of a location, such as London, using this code:
static final LatLng LONDON...