public final class MarkerOptions

  1. Object
  2. MarkerOptions

A fluent builder describing a Marker before it is added to a MapSurface. Only the position is required; every other property has a sensible default.

map.addMarker(new MarkerOptions(new LatLng(37.78, -122.40))
        .icon(pin)
        .title("Union Square")
        .anchor(0.5f, 1.0f)
        .onClick(e -> showDetails()));

Constructors

public MarkerOptions(LatLng position)Starts a builder for a marker at position.
public MarkerOptions()Starts a builder with the location supplied later via position.

Methods

public MarkerOptions position(LatLng position)Sets the marker location.
public MarkerOptions icon(EncodedImage icon)Sets the marker icon.
public MarkerOptions title(String title)Sets the info-window title.
public MarkerOptions snippet(String snippet)Sets the info-window secondary text.
public MarkerOptions anchor(float u, float v)Sets the icon anchor in normalized [0,1] image space.
public MarkerOptions draggable(boolean draggable)Makes the marker draggable (native providers only).
public MarkerOptions onClick(ActionListener onClick)Sets the tap listener.
public Marker build()Builds an immutable-by-convention Marker from this builder.

Inherited methods

Constructor details

MarkerOptions

public MarkerOptions(LatLng position)
Starts a builder for a marker at position.

MarkerOptions

public MarkerOptions()
Starts a builder with the location supplied later via position.

Method details

position

public MarkerOptions position(LatLng position)
Sets the marker location.

icon

public MarkerOptions icon(EncodedImage icon)
Sets the marker icon. When null the surface renders its default pin.

title

public MarkerOptions title(String title)
Sets the info-window title.

snippet

public MarkerOptions snippet(String snippet)
Sets the info-window secondary text.

anchor

public MarkerOptions anchor(float u, float v)
Sets the icon anchor in normalized [0,1] image space.

draggable

public MarkerOptions draggable(boolean draggable)
Makes the marker draggable (native providers only).

onClick

public MarkerOptions onClick(ActionListener onClick)
Sets the tap listener.

build

public Marker build()
Builds an immutable-by-convention Marker from this builder.