java.lang.Object | |
↳ | com.google.android.gms.maps.model.Marker |
An icon placed at a particular point on the map's surface. A marker icon is drawn oriented against the device's screen rather than the map's surface; i.e., it will not necessarily change orientation due to map rotations, tilting, or zooming.
A marker has the following properties:
LatLng
position of the marker. This defaults to 50% from the left of the image and at the bottom of the image.
LatLng
value for the marker's position on the map. You can change this value at any time if you want to move the marker.
defaultMarker(float)
. You can't change the icon once \ you've created the marker.
true
. You can change this value at any time. The default is
true
.
false
. You can change this value at any time.
GoogleMap map = ... // get a map.
// Add a marker at San Francisco.
Marker marker = map.add(new MarkerOptions()
.position(new LatLng(37.7750, 122.4183))
.title("San Francisco")
.snippet("Population: 776733"));
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
|
||||||||||
|
Gets this marker's id.
|
||||||||||
|
Returns the position of the marker.
|
||||||||||
|
Gets the snippet of the marker.
|
||||||||||
|
Gets the title of the marker.
|
||||||||||
|
|
||||||||||
|
Hides the info window if it is shown from this marker.
|
||||||||||
|
Gets the draggability of the marker.
|
||||||||||
|
Returns whether the info window is currently shown above this marker.
|
||||||||||
|
|
||||||||||
|
Removes this marker from the map.
|
||||||||||
|
Sets the draggability of the marker.
|
||||||||||
|
Sets the position of the marker.
|
||||||||||
|
Sets the snippet of the marker.
|
||||||||||
|
Sets the title of the marker.
|
||||||||||
|
Sets the visibility of this marker.
|
||||||||||
|
Shows the info window of this marker on the map, if this marker
isVisible() .
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Gets this marker's id.
When a map is restored from a Bundle
, markers that were on that map are also restored. However, those markers will then be represented by different Marker
objects. A marker's id can be used to retrieve the new incarnation of a Marker object after such restoration.
Returns the position of the marker.
LatLng
object specifying the marker's current position. Gets the snippet of the marker.
Gets the title of the marker.
Hides the info window if it is shown from this marker.
This method has no effect if this marker is not visible.
Gets the draggability of the marker. When a marker is draggable, it can be moved by the user by long pressing on the marker.
true
if the marker is draggable; otherwise, returns false
. Returns whether the info window is currently shown above this marker. This does not consider whether or not the info window is actually visible on screen.
Removes this marker from the map. After a marker has been removed, the behavior of all its methods is undefined.
Sets the draggability of the marker. When a marker is draggable, it can be moved by the user by long pressing on the marker.
Sets the snippet of the marker.
Sets the title of the marker.
Sets the visibility of this marker. If set to false
and an info window is currently showing for this marker, this will hide the info window.
Shows the info window of this marker on the map, if this marker isVisible()
.
IllegalArgumentException | if marker is not on this map |
---|