【发布时间】:2018-10-16 19:38:31
【问题描述】:
我需要设置夜间模式谷歌地图,它将使用手机中的传感器自动运行,并使用开关手动运行。我需要一些示例或文档
【问题讨论】:
标签: google-maps xamarin xamarin.forms
我需要设置夜间模式谷歌地图,它将使用手机中的传感器自动运行,并使用开关手动运行。我需要一些示例或文档
【问题讨论】:
标签: google-maps xamarin xamarin.forms
安装Xamarin.Forms.GoogleMaps Nuget 包(源代码可在GitHub 获得)
它已经在 Xamarin.Forms 上实现了它。
您可以参考 here 提供的 MapStylePage 示例,它基本上解释了如何使用 MapStyle With Google 创建原始地图样式。您可以使用向导,从那里选择 Night 主题并获取相应的 json 样式,您将在您的 Xamarin 应用程序上使用它。
【讨论】:
int currentNightMode = getResources().getConfiguration().uiMode
& Configuration.UI_MODE_NIGHT_MAS
switch (currentNightMode) {
case Configuration.UI_MODE_NIGHT_NO:
// Night mode is not active, we're in day time
case Configuration.UI_MODE_NIGHT_YES:
// Night mode is active, we're at night!
case Configuration.UI_MODE_NIGHT_UNDEFINED:
// We don't know what mode we're in, assume notnight
}
【讨论】: