@Deprecated public class Marker extends Annotation
IconFactory
to generate an
Icon
using a provided image. Markers are added to the map by first giving a
LatLng
and using MapboxMap.addMarker(MarkerOptions)
. The marker icon will be
centered at this position so it is common to add padding to the icon image before usage.
Markers are designed to be interactive. They receive click events by default, and are often used
with event listeners to bring up info windows. An InfoWindow
is displayed by default when
either a title or snippet is provided.
mapboxMap, mapView
Constructor and Description |
---|
Marker(BaseMarkerOptions baseMarkerOptions)
Deprecated.
Creates a instance of
Marker using the builder of Marker. |
Modifier and Type | Method and Description |
---|---|
Icon |
getIcon()
Deprecated.
Gets the
Icon currently used for the marker. |
InfoWindow |
getInfoWindow()
Deprecated.
Gets the
InfoWindow the marker is using. |
LatLng |
getPosition()
Deprecated.
Returns the position of the marker.
|
java.lang.String |
getSnippet()
Deprecated.
Gets the snippet of the marker.
|
java.lang.String |
getTitle()
Deprecated.
Gets the snippet of the marker.
|
void |
hideInfoWindow()
Deprecated.
Do not use this method, used internally by the SDK.
|
boolean |
isInfoWindowShown()
Deprecated.
Do not use this method, used internally by the SDK.
|
void |
setIcon(Icon icon)
Deprecated.
Sets the icon of the marker.
|
void |
setPosition(LatLng position)
Deprecated.
Sets the location of the marker.
|
void |
setRightOffsetPixels(int rightOffsetPixels)
Deprecated.
Do not use this method, used internally by the SDK.
|
void |
setSnippet(java.lang.String snippet)
Deprecated.
Sets the snippet of the marker.
|
void |
setTitle(java.lang.String title)
Deprecated.
Sets the title of the marker.
|
void |
setTopOffsetPixels(int topOffsetPixels)
Deprecated.
Do not use this method, used internally by the SDK.
|
InfoWindow |
showInfoWindow(MapboxMap mapboxMap,
MapView mapView)
Deprecated.
Do not use this method, used internally by the SDK.
|
java.lang.String |
toString()
Deprecated.
Returns a String with the marker position.
|
compareTo, equals, getId, getMapboxMap, getMapView, hashCode, remove, setId, setMapboxMap, setMapView
public Marker(BaseMarkerOptions baseMarkerOptions)
Marker
using the builder of Marker.baseMarkerOptions
- The builder used to construct the Marker.public LatLng getPosition()
LatLng
object specifying the marker's current position.public java.lang.String getSnippet()
public java.lang.String getTitle()
public void hideInfoWindow()
public boolean isInfoWindowShown()
public void setPosition(LatLng position)
position
- A LatLng
defining the marker position.public void setSnippet(java.lang.String snippet)
snippet
- A String used in the marker info window. If null
, the snippet is
cleared.public void setIcon(@Nullable Icon icon)
icon
- The Icon
to be used as Marker image@Nullable public Icon getIcon()
Icon
currently used for the marker. If no Icon was set for the marker, the
default icon will be returned.Icon
the marker is using.public void setTitle(java.lang.String title)
title
- A String used in the marker info window. If null
, the title is
cleared.@Nullable public InfoWindow getInfoWindow()
InfoWindow
the marker is using. If the marker hasn't had an info window
defined, this will return null
.@Nullable public InfoWindow showInfoWindow(@NonNull MapboxMap mapboxMap, @NonNull MapView mapView)
MapboxMap.selectMarker(Marker)
if you want to programmatically display the markers info window.mapboxMap
- The hosting mapbox map.mapView
- The hosting map view.public void setTopOffsetPixels(int topOffsetPixels)
topOffsetPixels
- the top offset pixels.public void setRightOffsetPixels(int rightOffsetPixels)
rightOffsetPixels
- the right offset pixels.public java.lang.String toString()
toString
in class java.lang.Object