public final class Marker extends Object
A marker has the following properties:
Anchor
The point on the image that will be placed at the LatLng position of the marker.
This defaults to 50% from the left of the image and at the bottom of the image.
Position
The GridPoint
value for the marker's position on the map. You can change this
value at any time if you want to move the marker.
Title
A text string that's displayed in an info window when the user taps the marker.
You can change this value at any time.
Snippet
Additional text that's displayed below the title. You can change this value at any time.
Icon
A bitmap that's displayed for the marker. If the icon is left unset, a default icon is displayed.
You can specify an alternative coloring of the default icon using defaultMarker(float).
You can't change the icon once you've created the marker.
Drag Status
If you want to allow the user to drag the marker, set this property to true.
You can change this value at any time. The default is false.
Visibility
By default, the marker is visible. To make the marker invisible, set this property to false.
You can change this value at any time.
Example
OSMap map = ... // get a map.
// Add a marker at Scafell Pike
Marker marker = map.addMarker(new MarkerOptions()
.position(GridPoint.parse("NY2154807223"))
.title("Scafell Pike")
.snippet("Highest Mountain in England"));
Developer Guide
For more information, read the Markers developer guide.
Modifier and Type | Method and Description |
---|---|
GridPoint |
getGridPoint()
Returns the position of the marker.
|
String |
getSnippet()
Gets the snippet of the marker.
|
String |
getTitle()
Gets the title of the marker.
|
void |
hideInfoWindow()
Hides the info window if it is shown from this marker.
|
boolean |
isDraggable()
Gets the draggability of the marker.
|
boolean |
isVisible() |
void |
remove()
Removes this marker from the map.
|
void |
setDraggable(boolean draggable)
Sets the draggability of the marker.
|
void |
setGridPoint(GridPoint gp) |
void |
setSnippet(String snippet)
Sets the snippet of the marker.
|
void |
setTitle(String title)
Sets the title of the marker.
|
void |
setVisible(boolean visible)
Sets the visibility of this marker.
|
void |
showInfoWindow()
Shows the info window of this marker on the map, if this marker
isVisible() . |
public GridPoint getGridPoint()
GridPoint
object specifying the marker's current positionpublic void setGridPoint(GridPoint gp)
public void setVisible(boolean visible)
public boolean isVisible()
public void showInfoWindow()
isVisible()
.public void hideInfoWindow()
This method has no effect if this marker is not visible.
public void setDraggable(boolean draggable)
public boolean isDraggable()
public void remove()
public void setTitle(String title)
public void setSnippet(String snippet)
public String getTitle()
public String getSnippet()
Copyright © 2012–2013 Ordnance Survey. All rights reserved.