Document Navigation SDK for Android Guides Customize the Navigation UI Custom Route Lines

Custom Route Lines

This document describes how to control the visibility of navigation route elements and customize route appearance using the AMapNaviView and AMapNaviViewOptions APIs.

Show or Hide Route Elements

Use the AMapNaviView class to control the visibility of route-related elements.

/**
 * Sets whether to hide the CarOverlay on AMapNaviView, including the self-vehicle icon and compass.
 * @param isVisible true to show, false to hide. Default is true (shown).
 * @since 6.2.0
 */
public void setCarOverlayVisible(boolean isVisible)

/**
 * Sets whether to hide traffic lights on the route.
 * @param isVisible true to show, false to hide. Default is true (shown).
 * @since 6.2.0
 */
public void setTrafficLightsVisible(boolean isVisible)

/**
 * Sets whether to display icons for start, end, and waypoints; walking and ferry transfer points;
 * and restriction, no-entry, and road-closure icons.
 * @param showStartEndVia whether to show start, end, and waypoint markers
 * @param showFootFerry   whether to show walking and ferry transfer point markers
 * @param showForbidden   whether to show restriction and no-entry icons
 * @since 7.4.0
 */
public void setRouteMarkerVisible(boolean showStartEndVia, boolean showFootFerry, boolean showForbidden)

Customize Route Appearance

Use the setRouteOverlayOptions method in AMapNaviViewOptions to set RouteOverlayOptions properties and customize the route appearance.

/**
 * Customizes the texture of the traveled route (solid line).
 * <p>
 * The default graying-out of the traveled route is disabled. To enable it, call
 * {@link com.amap.api.navi.AMapNaviViewOptions#setAfterRouteAutoGray(boolean)} first.
 * This method only takes effect when the graying feature is enabled.
 * </p>
 * @param passRoute the bitmap texture for the traveled route
 * @since 6.2.0
 */
public void setPassRoute(Bitmap passRoute)

/**
 * Sets whether to display 3D turn arrows. Default is shown.
 * @param turnArrowIs3 true to show, false to hide
 * @since 6.6.0
 */
public void setTurnArrowIs3D(boolean turnArrowIs3)

/**
 * Sets the width of the navigation route line.
 * @param lineWidth width in pixels
 */
public void setLineWidth(float lineWidth)

/**
 * Sets the texture bitmap for traffic conditions labeled as "very congested".
 * @param veryJamTraffic the bitmap image
 */
public void setVeryJamTraffic(Bitmap veryJamTraffic)

/**
 * Sets the texture bitmap for traffic conditions labeled as "smooth".
 * @param smoothTraffic the bitmap image
 */
public void setSmoothTraffic(Bitmap smoothTraffic)

/**
 * Sets the texture bitmap for traffic conditions labeled as "slow".
 * @param slowTraffic the bitmap image
 */
public void setSlowTraffic(Bitmap slowTraffic)