How to use Dark Mode Google Maps in Xamarin.Forms.Maps?

819 Views Asked by At

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

1

There are 1 best solutions below

1
On BEST ANSWER

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));