MapView

class MapView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : FrameLayout

MapView provides an embeddable map interface.

You use this class to display map information and to manipulate the map contents from your application. You can center the map on a given coordinate, specify the size of the area you want to display, and style the features of the map to fit your application's use case.

Constructors

Link copied to clipboard
constructor(context: Context, attrs: AttributeSet? = null)

Properties

Link copied to clipboard

Shortcut property to set the center of the map.

Link copied to clipboard

Language code, using ISO 3166-1 Alpha-2, indicating which language to use for labels.

Link copied to clipboard

Sets the stylers from a string encoded json.

Link copied to clipboard

Shortcut property to get the current zoom level or set it.

Functions

Link copied to clipboard
@RequiresPermission(anyOf = ["android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"])
fun activateLocationComponent(context: Context, action: OnLocationUpdate? = null)

Activate the user's location component on the MapView.

Link copied to clipboard
fun addMarker(marker: Marker)

Add a simple marker to be displayed onto this WoosmapView.

Link copied to clipboard

Add an action to be called if the Map fail to load.

Link copied to clipboard

Add an action to be called when the map finish loading.

Link copied to clipboard

Add an action to be called when the map finish loading its style.

Link copied to clipboard

Add an action to be called on a Map Click event.

Link copied to clipboard

Add an action to be called on a Map Long Click event.

Link copied to clipboard
fun easeCamera(update: CameraUpdate, durationMs: Int = 300, easingInterpolator: Boolean = true, callback: OnCameraDidChange? = null)

Gradually move the camera by a specified duration in milliseconds. Only properties specified within CameraUpdate will change. A callback can be used to be notified when the camera stops.

Link copied to clipboard
fun flyTo(update: CameraUpdate, durationMs: Int = 300, callback: OnCameraDidChange? = null)

Fly the camera (out then in) to a new position within a specified duration in milliseconds. Only properties specified within CameraUpdate will change. A callback can be used to be notified when the camera stops.

Link copied to clipboard
fun moveCamera(update: CameraUpdate, callback: OnCameraDidChange? = null)

Repositions the camera according to the instructions defined in the update. The move is instantaneous. Only properties specified within CameraUpdate will change.

Link copied to clipboard
fun onCreate(savedInstanceState: Bundle?)

You must call this method from the parent's Activity.onCreate or Fragment.onViewCreated.

Link copied to clipboard

You must call this method from the parent's Activity.onDestroy or Fragment.onDestroyView.

Link copied to clipboard

You must call this method from the parent's Activity.onLowMemory or Fragment.onLowMemory.

Link copied to clipboard

You must call this method from the parent's Activity.onPause or Fragment.onPause.

Link copied to clipboard

You must call this method from the parent's Activity.onResume or Fragment.onResume.

Link copied to clipboard

You must call this method from the parent's Activity.onSaveInstanceState or Fragment.onSaveInstanceState.

Link copied to clipboard

You must call this method from the parent's Activity.onStart or Fragment.onStart

Link copied to clipboard

You must call this method from the parent's Activity.onStop or Fragment.onStop.

Link copied to clipboard
fun removeMarker(marker: Marker)

Remove a marker from this WoosmapView.

Link copied to clipboard

Remove an action called if the Map fail to load.

Link copied to clipboard

Remove an action called when the map finish loading.

Link copied to clipboard

Remove an action called when the map finish loading its style.

Link copied to clipboard

Remove an action called on a Map Click event.

Link copied to clipboard

Remove an action called on a Map Long Click event.

Link copied to clipboard
fun setCenter(center: LatLng, animated: Boolean = false)
fun setCenter(center: LatLng, animated: Boolean = false, callback: OnCameraDidChange? = null)

Repositions the camera to target a given LatLng. Short-hand method for moveCamera(CameraUpdate(target)).

Link copied to clipboard
fun setUiSettings(action: UiSettings.() -> Unit)

Set UiSettings for your map.

Link copied to clipboard
fun setZoomLevel(zoomLevel: Double, animated: Boolean = false)
fun setZoomLevel(zoomLevel: Double, animated: Boolean = false, callback: OnCameraDidChange? = null)

Repositions the camera to a different zoom level. Short-hand method for moveCamera(CameraUpdate(zoom = z)).