SymbolLayer
instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java@Deprecated public class MarkerView extends Marker
View
at a geographical location. The
default marker uses a provided icon. This icon can be customized using IconFactory
to
generate an Icon
using a provided image. MarkerViews are added to the map by first giving
a LatLng
and using MapboxMap.addMarker(BaseMarkerViewOptions)
. The marker view icon
by default is anchored at the center bottom.
If many markers are needed to be displayed on the map at once we suggest using Marker
instead. This class uses MapboxMap.MarkerViewAdapter
to adapt a
MarkerView model to an Android SDK View
object.
MarkerViews 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 |
---|
MarkerView(BaseMarkerViewOptions baseMarkerViewOptions)
Deprecated.
Creates a instance of MarkerView using the builder of MarkerView
|
Modifier and Type | Method and Description |
---|---|
float |
getAlpha()
Deprecated.
Get the alpha value of the MarkerView.
|
float |
getAnchorU()
Deprecated.
Get the horizontal distance, normalized to [0, 1], of the anchor from the left edge.
|
float |
getAnchorV()
Deprecated.
Get the vertical distance, normalized to [0, 1], of the anchor from the top edge.
|
Icon |
getIcon()
Deprecated.
Get the icon of the MarkerView.
|
float |
getInfoWindowAnchorU()
Deprecated.
Get the horizontal distance, normalized to [0, 1], of the info window anchor from the left edge.
|
float |
getInfoWindowAnchorV()
Deprecated.
Get the vertical distance, normalized to [0, 1], of the info window anchor from the top edge.
|
float |
getRotation()
Deprecated.
Get the rotation value of the MarkerView.
|
boolean |
isFlat()
Deprecated.
Get the flat state of a MarkerView.
|
boolean |
isSelected()
Deprecated.
Determine if the
MarkerView is selected or not. |
boolean |
isVisible()
Deprecated.
Returns the visible state of the MarkerView.
|
void |
setAlpha(float alpha)
Deprecated.
Set the alpha value of the MarkerView.
|
void |
setAnchor(float u,
float v)
Deprecated.
Specifies the anchor being set on a particular point of the MarkerView.
|
void |
setFlat(boolean flat)
Deprecated.
Sets whether this MarkerView should be flat against the map (true) or a billboard facing the
camera (false).
|
void |
setIcon(Icon icon)
Deprecated.
Set the icon of the MarkerView.
|
void |
setInfoWindowAnchor(float u,
float v)
Deprecated.
Specifies the anchor point of the info window on the View of the MarkerView.
|
void |
setMapboxMap(MapboxMap mapboxMap)
Deprecated.
Set the MapboxMap associated tot the MapView containing the MarkerView.
|
void |
setPosition(LatLng position)
Deprecated.
Sets the location of the marker.
|
void |
setRotation(float rotation)
Deprecated.
Set the rotation value of the MarkerView in degrees.
|
void |
setVisible(boolean visible)
Deprecated.
Set the visible state of a MarkerView.
|
java.lang.String |
toString()
Deprecated.
Get the String representation of a MarkerView.
|
getInfoWindow, getPosition, getSnippet, getTitle, hideInfoWindow, isInfoWindowShown, setRightOffsetPixels, setSnippet, setTitle, setTopOffsetPixels, showInfoWindow
compareTo, equals, getId, getMapboxMap, getMapView, hashCode, remove, setId, setMapView
public MarkerView(BaseMarkerViewOptions baseMarkerViewOptions)
baseMarkerViewOptions
- the builder used to construct the MarkerViewpublic void setAnchor(float u, float v)
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.
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]).public float getAnchorU()
public float getAnchorV()
public void setInfoWindowAnchor(float u, float v)
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 default is the top middle of the View.
u
- u-coordinate of the info window anchor, as a ratio of the image width (in the range [0, 1]).v
- v-coordinate of the info window anchor, as a ratio of the image height (in the range [0, 1]).for more details.
public float getInfoWindowAnchorU()
public float getInfoWindowAnchorV()
public boolean isFlat()
public void setFlat(boolean flat)
flat
- the flat state of the MarkerView.public void setVisible(boolean visible)
visible
- true will make the MarkerView visible, false will hide the MarkerView.public boolean isVisible()
public void setRotation(float rotation)
Input will be limited to 0 - 360 degrees.
This will result in animating the rotation of the MarkerView using an rotation animator from current value to the provided parameter value.
rotation
- the rotation value to animate to.public float getRotation()
public float getAlpha()
public void setAlpha(float alpha)
This will result in animating the alpha of the MarkerView using an alpha animator from current value to the provided parameter value.
alpha
- the alpha value to animate to.public void setIcon(@Nullable Icon icon)
public void setPosition(LatLng position)
setPosition
in class Marker
position
- A LatLng
defining the marker position.public boolean isSelected()
MarkerView
is selected or not.public Icon getIcon()
public void setMapboxMap(MapboxMap mapboxMap)
This method is used to instantiate the MarkerView and provide an instance of
MapboxMap.MarkerViewAdapter
This method is used to notify that a MarkerView is no longer active by setting a null value.
setMapboxMap
in class Annotation
mapboxMap
- the MapboxMap instances.