-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change route line default color #173
Comments
The route line is made up of multiple layers stacked on top of each other. The top most line is the traffic line. It obscures the main line unless it is scaled to be narrower than the default width. What is observed above is the traffic line. The traffic can be hidden, if that's the desired effect, by either setting the traffic colors to Color.Transparent or by calling Changing the subject...
I don't recommend doing this. The timing of this layer being added to the map isn't guaranteed or predictable. I have seen cases in the past where this layer isn't present at the time the route line layers initialize and the route line ends up on top of the layer stack, which happens if the belowLayer isn't present. I suggest identifying a layer in the map style being used since it is baked into the style. The Mapbox navigation styles have a layer called |
Another option is to use |
I run into the same problem: // initialize route line, the withRouteLineBelowLayerId is specified to place
// the route line below road labels layer on the map
// the value of this option will depend on the style that you are using
// and under which layer the route line should be placed on the map layers stack
val mapboxRouteLineOptions = MapboxRouteLineOptions.Builder(this)
.withRouteLineBelowLayerId("road-label-navigation")
.withVanishingRouteLineEnabled(true)
.withRouteLineResources(
RouteLineResources.Builder()
.routeLineColorResources(
RouteLineColorResources.Builder()
.routeDefaultColor(Color.BLACK) //<--- Doesn't work
.routeLineTraveledColor(Color.GRAY)
.routeLineTraveledCasingColor(Color.DKGRAY)
.build()
)
.build()
)
.build()
routeLineApi = MapboxRouteLineApi(mapboxRouteLineOptions)
routeLineView = MapboxRouteLineView(mapboxRouteLineOptions) I am using the following version: |
Oh, I realized when set the |
I'm not able to change the route line default color as in the image below, I tried by changing routeDefaultColor without a result
val customColorResources = RouteLineColorResources.Builder() .routeCasingColor(Color.parseColor("#00DEDF")) .routeDefaultColor(Color.parseColor("#00DEDF"))//TODO :: it is not work .build() val routeLineResources = RouteLineResources.Builder() .routeLineColorResources(customColorResources) .build() val mapboxRouteLineOptions = MapboxRouteLineOptions.Builder(this) .withVanishingRouteLineEnabled(true) .withRouteLineResources(routeLineResources) .withRouteLineBelowLayerId(LocationComponentConstants.LOCATION_INDICATOR_LAYER) .build() routeLineApi = MapboxRouteLineApi(mapboxRouteLineOptions) routeLineView = MapboxRouteLineView(mapboxRouteLineOptions)
Navigation SDK : com.mapbox.navigation:android:2.9.4
any help here ?
The text was updated successfully, but these errors were encountered: