【问题标题】:How set auto day/night mode google maps in Xamarin Forms如何在 Xamarin Forms 中设置自动日/夜模式谷歌地图
【发布时间】:2018-10-16 19:38:31
【问题描述】:

我需要设置夜间模式谷歌地图,它将使用手机中的传感器自动运行,并使用开关手动运行。我需要一些示例或文档

【问题讨论】:

    标签: google-maps xamarin xamarin.forms


    【解决方案1】:

    安装Xamarin.Forms.GoogleMaps Nuget 包(源代码可在GitHub 获得) 它已经在 Xamarin.Forms 上实现了它。

    您可以参考 here 提供的 MapStylePage 示例,它基本上解释了如何使用 MapStyle With Google 创建原始地图样式。您可以使用向导,从那里选择 Night 主题并获取相应的 json 样式,您将在您的 Xamarin 应用程序上使用它。

    【讨论】:

      【解决方案2】:
      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
      }
      

      【讨论】:

        猜你喜欢
        • 2017-01-04
        • 1970-01-01
        • 1970-01-01
        • 2014-07-04
        • 2018-01-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多