3

I'm trying to use the Dark Mode Google Maps in my Xamarin.Forms app using the Xamarin.Forms.Maps nuget package.

I've managed to have Dark Mode on iOS Maps using this line of code in the CustomRenderer in the OnElementChanged if(e.NewElement != null) method:

nativeMap.OverrideUserInterfaceStyle= UIUserInterfaceStyle.Dark;

However I haven't been able to use it on Google Maps and wanted to know if there was anyway to get the same result and use Dark Mode Google Maps on Android.

Thank you for your help

Jimmy
  • 105
  • 15
  • About Google map style, I find one thread that you can take a look:https://stackoverflow.com/questions/52830934/how-set-auto-day-night-mode-google-maps-in-xamarin-forms – Cherry Bu - MSFT Jun 08 '21 at 05:52
  • @CherryBu-MSFT thank you ! However this won't work as I'm using Xamarin.Forms.Maps and it recommends using Xamarin.Forms.GoogleMaps which seems to be a package that doesn't work with the new versions of Xamarin – Jimmy Jun 10 '21 at 20:47

1 Answers1

2

Make a Raw Folder in xamarin.android and add you json file that have you Theme then write this code and its work. NativeMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this.Context, Resource.Raw.map_style_night));

  • ... just to add more detail here - check the documentation here https://developers.google.com/maps/documentation/android-sdk/styling ... and you can generate the json to include in your app here https://mapstyle.withgoogle.com/ – InquisitorJax Oct 27 '22 at 20:34