public class MarkerOptions
Defines attributes for a marker.
None.
| Construction Method |
| MarkerOptions() |
| Return type | Method name |
| MarkerOptions | alpha(float alpha) |
| MarkerOptions | anchor(float u, float v) |
| MarkerOptions | anchorMarker(float anchorU, float anchorV) |
| MarkerOptions | draggable(boolean draggable) |
| MarkerOptions | flat(boolean flat) |
| float | getAlpha() |
| float | getAnchorU() |
| float | getAnchorV() |
| BitmapDescriptor | getIcon() |
| float | getInfoWindowAnchorU() |
| float | getInfoWindowAnchorV() |
| LatLng | getPosition() |
| float | getRotation() |
| String | getSnippet() |
| String | getTitle() |
| float | getZIndex() |
| MarkerOptions | icon(BitmapDescriptor iconDescriptor) |
| MarkerOptions | infoWindowAnchor(float u, float v) |
| boolean | isDraggable() |
| boolean | isFlat() |
| boolean | isVisible() |
| MarkerOptions | position(LatLng latLng) |
| MarkerOptions | rotation(float rotation) |
| MarkerOptions | snippet(String snippet) |
| MarkerOptions | title(String title) |
| MarkerOptions | visible(boolean visible) |
| MarkerOptions | zIndex(float zIndex) |
| MarkerOptions | clusterable(boolean clusterable) |
| boolean | ismClusterable() |
| Method |
| public MarkerOptions alpha(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:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with new opacity. |
| Method |
| public MarkerOptions anchor(float u, float v) |
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 middle of the marker icon. This method has been deprecated. To set an anchor point, call anchorMarker. |
Parameters:
| Parameter name | Parameter desc |
| u | 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. |
| v | 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:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new anchor point. |
| Method |
| public MarkerOptions anchorMarker(float anchorU, float anchorV) |
Sets the anchor point of a marker. The anchor point is used to anchor a marker image to the map. The coordinates (0, 0), (1, 0), (0, 1), and (1, 1) respectively indicate the top-left, top-right, bottom-left, and bottom-right corners of the marker image. The following figure shows a marker's anchor point X whose coordinates are (0.5, 0.3).
|
Parameters:
| Parameter name | Parameter desc |
| u | 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. |
| v | 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:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new anchor point. |
| Method |
| public MarkerOptions draggable(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:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new draggability setting. |
| Method |
| public MarkerOptions flat(boolean flat) |
| Specifies whether to flatly attach a marker to the map. If the marker is flatly attached to the map, it will stay on the map when the camera rotates or tilts. Different from GroundOverlay, the marker will remain the same size when the camera zooms in or out. If the marker faces the camera, it will always be drawn facing the camera and rotates or tilts with the camera. |
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:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new flat attribute setting. |
| 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 float getAnchorU() |
| Obtains the U coordinate of the anchor point of a marker. The coordinate ranges from 0 to 1, starting from the left edge of the marker image. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| float | U coordinate of the anchor point of a marker. |
| Method |
| public float getAnchorV() |
| Obtains the V coordinate of the anchor point of a marker. The coordinate ranges from 0 to 1, starting from the top edge of the marker image. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| float | V coordinate of the anchor point of a marker. |
| Method |
| public BitmapDescriptor getIcon() |
| Obtains the icon of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| BitmapDescriptor | BitmapDescriptor object of an icon. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| float | U coordinate of the anchor point of an information window. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| float | V coordinate of the anchor point of an information window. |
| Method |
| public LatLng getPosition() |
| Obtains the position of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| LatLng | Position of a marker. |
| Method |
| public float getRotation() |
| Obtains the rotation angle of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| float | Rotation angle of a marker. |
| Method |
| public String getSnippet() |
| Obtains the text of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| String | Text of a marker. |
| Method |
| public String getTitle() |
| Obtains the title of a marker. |
Parameters:
None.
Return:
| Return type | Parameter desc |
| String | Title 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 MarkerOptions icon(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:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new icon. |
| Method |
| public MarkerOptions infoWindowAnchor(float u, float v) |
| 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 anchor(float u, float v) method. By default, the top-middle point of the information window is used as the anchor point. |
Parameters:
| Parameter name | Parameter desc |
| u | 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. |
| v | 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:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with new coordinates of the anchor point of an information window. |
| Method |
| public 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 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. |
| Method |
| public 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 MarkerOptions position(LatLng latLng) |
| Sets the position of a marker. |
Parameters:
| Parameter name | Parameter desc |
| latLng | Position coordinates of a marker. |
Return:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new position. |
| Method |
| public MarkerOptions rotation(float rotation) |
| Sets the rotation angle of a marker, that is, the angle in which the marker rotates around the anchor point clockwise. The rotation axis is perpendicular to the marker. By default, the marker is north aligned, and the rotation angle is 0 degrees. |
Parameters:
| Parameter name | Parameter desc |
| rotation | Rotation angle of a marker. The default value is 0. |
Return:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new rotation angle. |
| Method |
| public MarkerOptions snippet(String snippet) |
| Sets the text of a marker. |
Parameters:
| Parameter name | Parameter desc |
| snippet | Text. |
Return:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with new text. |
| Method |
| public MarkerOptions title(String title) |
| Sets the title of a marker. |
Parameters:
| Parameter name | Parameter desc |
| title | Title. |
Return:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new title. |
| Method |
| public MarkerOptions visible(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:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new visibility setting. |
| Method |
| public MarkerOptions zIndex(float zIndex) |
| Sets the z-index of a marker. The z-index indicates the overlapping order of a marker. A marker with a larger z-index overlaps that with a smaller z-index. Markers with the same z-index overlap each other in a random order. By default, the z-index is 0. |
Parameters:
| Parameter name | Parameter desc |
| zIndex | Z-index, which indicates the overlapping order of a marker. |
Return:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object with a new z-index. |
| Method |
| public MarkerOptions clusterable(boolean clusterable) |
| Sets the cluster attribute of a marker. |
Parameters:
| Parameter name | Parameter desc |
| clusterable | Indicates whether a marker can be clustered. The options are true (yes) and false (no). |
Return:
| Return type | Parameter desc |
| MarkerOptions | MarkerOptions object where the cluster attribute has been set. |
| Method |
| public boolean ismClusterable() |
| Obtains the cluster attribute of a MarkerOptions object. |
Parameters:
None.
| Parameter name | Parameter desc |
Return:
| Return type | Parameter desc |
| boolean | The options are true (yes) and false (no). |