如何更改 Google 地图标记的颜色? [英] How can I change the color of a Google Maps marker?

查看:62
本文介绍了如何更改 Google 地图标记的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Google Maps API 来构建一个充满标记的地图,但我希望一个标记能从其他标记中脱颖而出.我认为,最简单的做法是将标记的颜色更改为蓝色,而不是红色.这是一件简单的事情还是我必须以某种方式创建一个全新的图标?如果我必须创建一个新图标,最简单的方法是什么?

I'm using the Google Maps API to build a map full of markers, but I want one marker to stand out from the others. The simplest thing to do, I think, would be to change the color of the marker to blue, instead of red. Is this a simple thing to do or do I have to create a whole new icon somehow? If I do have to create a new icon, what's the easiest way to do that?

推荐答案

由于地图 v2 已弃用,您可能对 v3 地图感兴趣:https://developers.google.com/maps/documentation/javascript/markers#simple_icons

Since maps v2 is deprecated, you are probably interested in v3 maps: https://developers.google.com/maps/documentation/javascript/markers#simple_icons

对于 v2 地图:

http://code.google.com/apis/maps/文档/overlays.html#Icons_overview

您将有一组逻辑处理所有常规"引脚,另一组逻辑使用定义的新标记处理特殊"引脚.

You would have one set of logic do all the 'regular' pins, and another that does the 'special' pin(s) using the new marker defined.

这篇关于如何更改 Google 地图标记的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆