【问题标题】:Google Map text style appears different on Android than in the Styling WizardGoogle Map 文本样式在 Android 上的显示与样式向导中的不同
【发布时间】:2018-12-20 23:44:52
【问题描述】:

我在样式向导 (https://mapstyle.withgoogle.com/) 中创建了一个 Google 地图样式,它在我的 Android 应用程序中产生的结果与向导中显示的结果不同。文本标签看起来很笨重,好像重量很大。

这是从样式向导复制到我的应用程序中的 json:

[
  {
    "elementType": "labels.text",
    "stylers": [
      {
        "color": "#ffffff"
      },
      {
        "visibility": "off"
      },
      {
        "weight": 0.1
      }
    ]
  },
  {
   "featureType": "landscape",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#474644"
      }
    ]
  },
  {
    "featureType": "poi",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#626061"
      }
    ]
  },
  {
    "featureType": "poi.park",
   "elementType": "geometry",
    "stylers": [
      {
        "color": "#626061"
      }
    ]
  },
  {
    "featureType": "poi.park",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "road",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#666666"
      }
    ]
  },
  {
    "featureType": "road",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "on"
      }
    ]
  }
]

以下是地图在样式向导中的显示方式:

这是我的 Android 应用程序中的结果:

【问题讨论】:

    标签: android google-maps google-maps-android-api-2 google-maps-styled


    【解决方案1】:

    我可以通过在我的 Android 应用程序中将样式器添加到我的 json 来解决此问题,该应用程序将所有标签文本填充的可见性设置为 off

    {
         "elementType": "labels.text.fill",
         "stylers": [
           {
             "visibility": "off"
            }
         ]
    }
    

    【讨论】:

      猜你喜欢
      • 2011-12-06
      • 2011-02-23
      • 1970-01-01
      • 2013-08-16
      • 2021-08-16
      • 1970-01-01
      • 1970-01-01
      • 2021-07-25
      • 1970-01-01
      相关资源
      最近更新 更多