Skip to content

MapView API

peterLaurence edited this page Mar 23, 2020 · 2 revisions

This page is under construction - it isn't complete yet.

Markers APIs

addMarker Add a marker to the the MapView. The marker can be any View. No LayoutParams are required; the View will be laid out using WRAP_CONTENT for both width and height, and positioned based on the parameters.

Params

  • view - View instance to be added to the TileView.
  • x - Relative x position the View instance should be positioned at.
  • y - Relative y position the View instance should be positioned at.
  • relativeAnchorLeft - The x-axis position of a marker will be offset by a number equal to the width of the marker multiplied by this value.
  • relativeAnchorTop - The y-axis position of a marker will be offset by a number equal to the height of the marker multiplied by this value.
  • absoluteAnchorLeft - The x-axis position of a marker will be offset by this value.
  • absoluteAnchorTop - The y-axis position of a marker will be offset by this value.
fun MapView.addMarker(view: View, x: Double, y: Double, relativeAnchorLeft: Float = -0.5f,
                      relativeAnchorTop: Float = -1f, absoluteAnchorLeft: Float = 0f,
                      absoluteAnchorTop: Float = 0f)
moveMarker Moves an existing marker to another position.

Params

  • view - The marker View to be repositioned.
  • x - Relative x position the View instance should be positioned at.
  • y - Relative y position the View instance should be positioned at.
fun MapView.moveMarker(view: View, x: Double, y: Double)
setMarkerTapListener Set a MarkerTapListener for the MapView instance (rather than on a single marker view). Unlike standard touch events attached to marker View's (e.g., View.OnClickListener), MarkerTapListener.onMarkerTapEvent does not consume the touch event, so will not interfere with scrolling.
fun MapView.setMarkerTapListener(markerTapListener: MarkerTapListener) 
addCallout Add a callout to the the MapView. The callout can be any View. No LayoutParams are required; the View will be laid out using WRAP_CONTENT for both width and height, and positioned based on the parameters.
fun MapView.addCallout(view: View, x: Double, y: Double, relativeAnchorLeft: Float = -0.5f,
                       relativeAnchorTop: Float = -1f, absoluteAnchorLeft: Float = 0f,
                       absoluteAnchorTop: Float = 0f)
Clone this wiki locally