implements Parcelable
Defines the options for a marker.
Inherited Constant Summary
Field Summary
public static final Creator<MarkerOptions> | CREATOR |
Public Constructor Summary
Public Method Summary
MarkerOptions |
anchor(float u, float v)
Specifies the anchor to be at a particular point in the marker image.
|
int | |
float |
getAnchorU()
Horizontal distance, normalized to [0, 1], of the anchor from the left edge.
|
float |
getAnchorV()
Vertical distance, normalized to [0, 1], of the anchor from the top edge.
|
Bitmap |
getIcon()
Returns the custom icon set for this MarkerOptions object.
|
LatLng |
getPosition()
Returns the position set for this MarkerOptions object.
|
String |
getTitle()
Returns the title of this MarkerOptions object.
|
MarkerOptions |
icon(Bitmap icon)
Sets the icon for the marker.
|
MarkerOptions | |
MarkerOptions |
title(String title)
Sets the title of the marker.
|
void |
writeToParcel(Parcel out, int flags)
|
Inherited Method Summary
Fields
Public Constructors
public MarkerOptions ()
Public Methods
public MarkerOptions anchor (float u, float v)
Specifies the anchor to be at a particular point in the marker image.
The anchor specifies the point in the icon image that is anchored to the marker's position on the Earth's surface.
The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0], where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner. The anchoring point in a W x H image is the nearest discrete grid point in a (W + 1) x (H + 1) grid, obtained by scaling then rounding. For example, in a 4 x 2 image, the anchor point (0.7, 0.6) resolves to the grid point at (3, 1).
*-----+-----+-----+-----* | | | | | | | | | | +-----+-----+-----+-----+ | | | X | | (U, V) = (0.7, 0.6) | | | | | *-----+-----+-----+-----* *-----+-----+-----+-----* | | | | | | | | | | +-----+-----+-----X-----+ (X, Y) = (3, 1) | | | | | | | | | | *-----+-----+-----+-----*
Parameters
u | u-coordinate of the anchor, as a ratio of the image width (in the range [0, 1]) |
---|---|
v | v-coordinate of the anchor, as a ratio of the image height (in the range [0, 1]) |
Returns
- the object for which the method was called, with the new anchor set.
public int describeContents ()
public float getAnchorU ()
Horizontal distance, normalized to [0, 1], of the anchor from the left edge.
Returns
- the u value of the anchor.
public float getAnchorV ()
Vertical distance, normalized to [0, 1], of the anchor from the top edge.
Returns
- the v value of the anchor.
public Bitmap getIcon ()
Returns the custom icon set for this MarkerOptions object.
Returns
- a Bitmap representing the custom icon, or
null
if no custom icon is set
public LatLng getPosition ()
Returns the position set for this MarkerOptions object.
Returns
- a LatLng object specifying the position of the marker, or
null
if no position is set
public String getTitle ()
Returns the title of this MarkerOptions object.
Returns
- the title of the marker, or an empty String if no title has been set
public MarkerOptions icon (Bitmap icon)
Sets the icon for the marker. If no icon is supplied, the default pin style will be used.
Parameters
icon | the icon Bitmap |
---|
Returns
- the object for which the method was called, with the new icon set
public MarkerOptions position (LatLng latLng)
Sets the location for the marker.
Parameters
latLng | the new position to set |
---|
Returns
- the object for which the method was called, with the new position set
public MarkerOptions title (String title)
Sets the title of the marker. The default title is an empty String.
Parameters
title | the title to set |
---|
Returns
- the object for which the method was called, with the new title set
public void writeToParcel (Parcel out, int flags)
Parameters
out | |
---|---|
flags |