public class Marker
Defines an icon placed at a specified position on a map.
None.
None.
| Return type | Method name |
| boolean | equals(Object other) |
| float | getAlpha() |
| String | getId() |
| LatLng | getPosition() |
| float | getRotation() |
| String | getSnippet() |
| Object | getTag() |
| String | getTitle() |
| float | getZIndex() |
| int | hashCode() |
| void | hideInfoWindow() |
| boolean | isClusterable() |
| boolean | isDraggable() |
| boolean | isFlat() |
| boolean | isInfoWindowShown() |
| boolean | isVisible() |
| void | remove() |
| void | setAlpha(float alpha) |
| void | setAnchor(float anchorU, float anchorV) |
| void | setMarkerAnchor(float anchorU, float anchorV) |
| void | setDraggable(boolean draggable) |
| void | setFlat(boolean flat) |
| void | setIcon(BitmapDescriptor iconDescriptor) |
| void | setInfoWindowAnchor(float anchorU, float anchorV) |
| void | setPosition(LatLng latLng) |
| void | setRotation(float rotation) |
| void | setSnippet(String snippet) |
| void | setTag(Object tag) |
| void | setTitle(String title) |
| void | setVisible(boolean visible) |
| void | setZIndex(float zIndex) |
| void | showInfoWindow() |
| Method |
| public boolean equals(Object other) |
| Checks whether a Marker object equals another. |
Parameters:
| Parameter name | Parameter desc |
| other | Name of another Marker object. |
Return:
| Return type | Parameter desc |
| boolean | If the Marker objects are equal, true is returned. Otherwise, false is returned. |
| Method |
| public float getAlpha() |
| Obtains the opacity of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| float | Opacity of a marker. The value ranges from 0 to 1. |
| Method |
| public final String getId() |
| Obtains the ID of a marker on a map. The ID will be unique among all markers on a map. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| String | ID of a marker. |
| Method |
| public final LatLng getPosition() |
| Obtains the position of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| LatLng | Position of a marker. |
| Method |
| public final float getRotation() |
| Obtains the rotation angle of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| float | Rotation angle of a marker. |
| Method |
| public final String getSnippet() |
| Obtains the text of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| String | Text of a marker. |
| Method |
| public Object getTag() |
| Obtains the tag of a marker if the tag has been set. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| Object | Tag of a marker. If no tag has been set, null is returned. |
| Method |
| public final String getTitle() |
| Obtains the title of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| String | Title string of a marker. |
| Method |
| public float getZIndex() |
| Obtains the z-index of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| float | Z-index, which indicates the overlapping order of a marker. |
| Method |
| public int hashCode() |
| Obtains the hash code of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| int | Hash code of a marker. |
| Method |
| public final void hideInfoWindow() |
| Hides the information window that is displayed for a marker. This method is invalid for invisible markers. |
Parameters:
None.
Return:
None.
| Method |
| public boolean isClusterable() |
| Obtains the cluster attribute of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| boolean | Indicates whether a marker can be clustered. The options are true (yes) and false (no). |
| Method |
| public final boolean isDraggable() |
| Checks whether a marker can be dragged. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| boolean | If a marker can be dragged, true is returned. Otherwise, false is returned. |
| Method |
| public final boolean isFlat() |
| Checks whether a marker is flatly attached to the map. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| boolean | If a marker is flatly attached to the map, true is returned. If a marker faces the camera, false is returned. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| boolean | If an information window is currently displayed, true is returned. Otherwise, false is returned. |
| Method |
| public final boolean isVisible() |
| Checks whether a marker is visible. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| boolean | If a marker is visible, true is returned. Otherwise, false is returned. |
| Method |
| public final void remove() |
| Removes a marker from the map. |
Parameters:
None.
Return:
None.
| Method |
| public final void setAlpha(float alpha) |
| Sets the opacity of a marker. |
Parameters:
| Parameter name | Parameter desc |
| alpha | Opacity. The value ranges from 0 (completely transparent) to 1 (completely opaque). |
Return:
None.
| Method |
| public final void setAnchor(float anchorU, float anchorV) |
Sets the anchor point of a marker. Since of the values of U and V are fixed, this method always sets the anchor point to the bottom of the marker icon.This method has been deprecated. To set an anchor point, call setMarkerAnchor. |
Parameters:
| Parameter name | Parameter desc |
| anchorU | U coordinate of the anchor point of a marker. The value ranges from 0 to 1, expressed in a proportion of the marker image width. |
| anchorV | V coordinate of the anchor point of a marker. The value ranges from 0 to 1, expressed in a proportion of the marker image height. |
Return:
None.
Parameters:
| Parameter name | Parameter desc |
| anchorU | U coordinate of the anchor point of a marker. The value ranges from 0 to 1, expressed in a proportion of the marker image width. |
| anchorV | V coordinate of the anchor point of a marker. The value ranges from 0 to 1, expressed in a proportion of the marker image height. |
Return:
None.
| Method |
| public final void setDraggable(boolean draggable) |
| Specifies whether a marker can be dragged. |
Parameters:
| Parameter name | Parameter desc |
| draggable | Indicates whether a marker can be dragged. The options are true (yes) and false (no). |
Return:
None.
Parameters:
| Parameter name | Parameter desc |
| flat | Indicates whether to flatly attach a marker to the map. The options are true (flatly attaching to the map) and false (facing the camera). The default value is false. |
Return:
None.
| Method |
| public final void setIcon(BitmapDescriptor iconDescriptor) |
| Sets the icon of a marker. If null is passed, the default marker is used. |
Parameters:
| Parameter name | Parameter desc |
| iconDescriptor | Object containing an icon. |
Return:
None.
| Method |
| public final void setInfoWindowAnchor(float anchorU, float anchorV) |
| Sets the anchor point of the information window of a marker. The coordinate system used is the same as that of the anchor point of a marker. For details, please refer to the setAnchor(float anchorU, float anchorV) method. By default, the top-middle point of the information window is used as the anchor point. |
Parameters:
| Parameter name | Parameter desc |
| anchorU | U coordinate of the anchor point of an information window. The value ranges from 0 to 1, expressed in a proportion of the information window width. |
| anchorV | V coordinate of the anchor point of an information window. The value ranges from 0 to 1, expressed in a proportion of the information window height. |
Return:
None.
| Method |
| public final void setPosition(LatLng latLng) |
| Sets the position of a marker. |
Parameters:
| Parameter name | Parameter desc |
| latLng | Position coordinates of a marker. |
Return:
None.
Parameters:
| Parameter name | Parameter desc |
| rotation | Rotation angle of a marker. The default value is 0. |
Return:
None.
| Method |
| public final void setSnippet(String snippet) |
| Sets the text of a marker. If null is passed, the existing text is cleared. |
Parameters:
| Parameter name | Parameter desc |
| snippet | Text. |
Return:
None.
| Method |
| public final void setTag(Object tag) |
| Sets the tag of a marker. If null is passed, the existing tag is cleared. |
Parameters:
| Parameter name | Parameter desc |
| tag | Tag of a marker. |
Return:
None.
| Method |
| public final void setTitle(String title) |
| Sets the title of a marker. By default, the title is empty. |
Parameters:
| Parameter name | Parameter desc |
| title | Title string. If this parameter is set to null, the existing title is cleared. |
Return:
None.
| Method |
| public final void setVisible(boolean visible) |
| Specifies whether a marker is visible. |
Parameters:
| Parameter name | Parameter desc |
| visible | Indicates whether a marker is visible. The options are true (yes) and false (no). |
Return:
None.
Parameters:
| Parameter name | Parameter desc |
| zIndex | Z-index, which indicates the overlapping order of a marker. |
Return:
None.
| Method |
| public final void showInfoWindow() |
| Displays an information window for a marker. |
Parameters:
None.
Return:
None.
Exception:
| Exception Type | Scenario |
| IllegalArgumentException | No marker is displayed on the map. |