2

I created a custom NavigationView Fragment which I am calling from my MapView Fragment. Following the example in the documentation I tried to use runtime styling within the navigationView.xml file by creating a custom style. So far I can customize every element while starting my turn-by-turn navigation within my custom NavigationView apart from the map view itself.

At my MapView Fragment I am already using the light- color theme and it renders the map colors as expected.

<com.mapbox.mapboxsdk.maps.MapView
            android:id="@+id/map_view"
            ...
            mapbox:mapbox_styleUrl="mapbox://styles/mapbox/light-v9"/>

However I am using a styleUrl the same way in my navigationView.xml which doesn't have any effect on the graphical presentation of the turn-by-turn navigation view. It still shows the default -day navigation styling. But in case of consistency I would like to have the same styling for my map view as well as for my navigation view.

<com.mapbox.services.android.navigation.ui.v5.NavigationView
            android:id="@+id/navigation_view"
           ...
            app:navigationLightTheme="@style/CustomNavigationViewLight"/>

In my style.xml file I added the following line as described:

<!-- Map style -->
        <item name="navigationViewMapStyle">@string/navigation_guidance_light</item>

In my string.xml file I added the following line with the stylesUrl:

<string name="navigation_guidance_light"
        translatable="false">mapbox://styles/mapbox/light-v9</string>

As the MapView instance within NavigationView is a private member I have no direct possibility to access it and add a UrlStyle programmatically. Is there any better solution?

Actual turn-by-turn navigation view:

Actual Navigation View Style

I would like to add the same light style to my navigation view as displayed beyond.

Desired Navigation View Style

Alica
  • 107
  • 2
  • 9
  • how about creating a custom style and adding it in your maps https://www.mapbox.com/studio/ ? – nimi0112 Nov 29 '18 at 18:00
  • More info about Mapbox styles here https://www.mapbox.com/studio-manual/reference/styles/#style-editor – nimi0112 Nov 29 '18 at 18:01
  • @nimi0112 thanks for the hint, I saw this already but I hoped I could just use what is already there in case of styling themes. I am not sure if this is an issue of how my custom style is created as I can add the StyleUrl to my MapView within the xml file and it renders exactly as expected, but somehow doesn't make any change to my NavigationView. – Alica Nov 30 '18 at 18:35

0 Answers0