MPDirectionsRendererOptions
An immutable set of style and behaviour options for a route rendered by MPDirectionsRenderer.
This mirrors the Web SDK DirectionsRendererOptions pattern and aligns with the iOS equivalent, encapsulating all polyline styling and animation behaviour in a single value object. Apply a set of options with MPDirectionsRenderer.setOptions; when a route is already displayed the options are applied immediately, re-styling it in place.
Every property is optional and has a sensible default, so you only need to specify what you want to change. From Kotlin, use named arguments:
val options = MPDirectionsRendererOptions(
strokeColor = Color.RED,
strokeWeight = 6f,
)
renderer.setOptions(options)From Java, the generated overloaded constructors let you supply a leading subset of the same parameters, or use new MPDirectionsRendererOptions() for the defaults.
Constructors
Properties
Optional independent ARGB color for the animated overlay drawn on top of the route line. null (the default) reuses strokeColor.
Opacity of the animated overlay, in the range 0.0–1.0. Defaults to 1.0.
Width of the animated overlay, in pixels. Defaults to 2.
Lower bound for the animation duration, in seconds, applied when a route is short enough that animationSpeed alone would otherwise produce a very brief animation. Defaults to 1.2.
Whether the route animation repeats. Defaults to true.
Speed of the route animation, in meters per second. Together with animationMinDuration this determines the animation duration for a given route length. Defaults to 300.
Optional upper bound for the zoom level used when fitting the camera to the route. null (the default) leaves the zoom uncapped.
Force the route animation to play even when the system "reduce motion" accessibility setting is enabled. Defaults to false.
ARGB color of the route line. Replaces the foreground argument of the deprecated MPDirectionsRenderer.setPolylineColors. Defaults to the MapsIndoors directions blue (DEFAULT_STROKE_COLOR).
Opacity of the route line, in the range 0.0–1.0. Exposed as a standalone value rather than being baked into the alpha channel of strokeColor. Defaults to 1.0.
How the line is drawn — MPStrokeStyle.SOLID, MPStrokeStyle.DASHED or MPStrokeStyle.DOTTED. Defaults to MPStrokeStyle.SOLID.
Width of the route line, in pixels. Defaults to 4.