目录

public class MarkerOptions

Defines attributes for a marker.

Public Fields

None.

Constructor

Construction Method
MarkerOptions()

Public Method Summary

Return typeMethod name
MarkerOptionsalpha(float alpha)
MarkerOptionsanchor(float u, float v)
MarkerOptionsanchorMarker(float anchorU, float anchorV)
MarkerOptionsdraggable(boolean draggable)
MarkerOptionsflat(boolean flat)
floatgetAlpha()
floatgetAnchorU()
floatgetAnchorV()
BitmapDescriptorgetIcon()
floatgetInfoWindowAnchorU()
floatgetInfoWindowAnchorV()
LatLnggetPosition()
floatgetRotation()
StringgetSnippet()
StringgetTitle()
floatgetZIndex()
MarkerOptionsicon(BitmapDescriptor iconDescriptor)
MarkerOptionsinfoWindowAnchor(float u, float v)
booleanisDraggable()
booleanisFlat()
booleanisVisible()
MarkerOptionsposition(LatLng latLng)
MarkerOptionsrotation(float rotation)
MarkerOptionssnippet(String snippet)
MarkerOptionstitle(String title)
MarkerOptionsvisible(boolean visible)
MarkerOptionszIndex(float zIndex)
MarkerOptionsclusterable(boolean clusterable) 
booleanismClusterable() 

Public Methods

Method
public MarkerOptions alpha(float alpha)
Sets the opacity of a marker.


Parameters:

Parameter nameParameter desc
alphaOpacity. The value ranges from 0 (completely transparent) to 1 (completely opaque).


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions 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 nameParameter desc
uU coordinate of the anchor point of a marker. The value ranges from 0 to 1, expressed in a proportion of the marker image width.
vV 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 typeParameter desc
MarkerOptionsMarkerOptions 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 nameParameter desc
uU coordinate of the anchor point of a marker. The value ranges from 0 to 1, expressed in a proportion of the marker image width.
vV 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 typeParameter desc
MarkerOptionsMarkerOptions object with a new anchor point.
Method
public MarkerOptions draggable(boolean draggable)
Specifies whether a marker can be dragged.


Parameters:

Parameter nameParameter desc
draggableIndicates whether a marker can be dragged. The options are true (yes) and false (no).


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions 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 nameParameter desc
flatIndicates 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 typeParameter desc
MarkerOptionsMarkerOptions object with a new flat attribute setting.
Method
public float getAlpha()
Obtains the opacity of a marker.


Parameters:
None.
Return:

Return typeParameter desc
floatOpacity 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 typeParameter desc
floatU 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 typeParameter desc
floatV coordinate of the anchor point of a marker.
Method
public BitmapDescriptor getIcon()
Obtains the icon of a marker.


Parameters:
None.
Return:

Return typeParameter desc
BitmapDescriptorBitmapDescriptor object of an icon.
Method
public float getInfoWindowAnchorU()
Obtains the U coordinate of the anchor point of a marker's information window. The coordinate ranges from 0 to 1, starting from the left edge of the information window.


Parameters:
None.
Return:

Return typeParameter desc
floatU coordinate of the anchor point of an information window.
Method
public float getInfoWindowAnchorV()
Obtains the V coordinate of the anchor point of a marker's information window. The coordinate ranges from 0 to 1, starting from the top edge of the information window.


Parameters:
None.
Return:

Return typeParameter desc
floatV coordinate of the anchor point of an information window.
Method
public LatLng getPosition()
Obtains the position of a marker.


Parameters:
None.
Return:

Return typeParameter desc
LatLngPosition of a marker.
Method
public float getRotation()
Obtains the rotation angle of a marker.


Parameters:
None.
Return:

Return typeParameter desc
floatRotation angle of a marker.
Method
public String getSnippet()
Obtains the text of a marker.


Parameters:
None.
Return:

Return typeParameter desc
StringText of a marker.
Method
public String getTitle()
Obtains the title of a marker.


Parameters:
None.
Return:

Return typeParameter desc
StringTitle of a marker.
Method
public float getZIndex()
Obtains the z-index of a marker.


Parameters:
None.
Return:

Return typeParameter desc
floatZ-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 nameParameter desc
iconDescriptorObject containing an icon.


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions 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 nameParameter desc
uU 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.
vV 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 typeParameter desc
MarkerOptionsMarkerOptions 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 typeParameter desc
booleanIf 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 typeParameter desc
booleanIf 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 typeParameter desc
booleanIf 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 nameParameter desc
latLngPosition coordinates of a marker.


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions 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 nameParameter desc
rotationRotation angle of a marker. The default value is 0.


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions object with a new rotation angle.
Method
public MarkerOptions snippet(String snippet)
Sets the text of a marker.


Parameters:

Parameter nameParameter desc
snippetText.


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions object with new text.
Method
public MarkerOptions title(String title)
Sets the title of a marker.


Parameters:

Parameter nameParameter desc
titleTitle.


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions object with a new title.
Method
public MarkerOptions visible(boolean visible)
Specifies whether a marker is visible.


Parameters:

Parameter nameParameter desc
visibleIndicates whether a marker is visible. The options are true (yes) and false (no).


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions 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 nameParameter desc
zIndexZ-index, which indicates the overlapping order of a marker.


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions object with a new z-index.
Method
public MarkerOptions clusterable(boolean clusterable)
Sets the cluster attribute of a marker.


Parameters:

Parameter nameParameter desc
clusterableIndicates whether a marker can be clustered. The options are true (yes) and false (no).


Return:

Return typeParameter desc
MarkerOptionsMarkerOptions object where the cluster attribute has been set.
Method
public boolean ismClusterable()
Obtains the cluster attribute of a MarkerOptions object.


Parameters:

None.

Parameter nameParameter desc

Return:

Return typeParameter desc
booleanThe options are true (yes) and false (no).