如何更改Google地图中标记的颜色? [英] How to change color of marker in Google Map?

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

问题描述

我不会使用GIcon来改变marker.Any其他方法来改变标记的颜色???

I won't use GIcon to change for the marker.Any other ways to change color of marker???

推荐答案

不,如果您不想自定义标记,则需要使用 GIcon

Nope, if you wan't to customize your marker, you will need to use GIcon.

您可以在 Google Maps Icons Project 。使用自定义标记的代码非常简单:

You can find a whole lot of free markers at the Google Maps Icons Project. The code to use a custom marker is pretty straightforward:

// Create our "tiny" marker icon
var blueIcon = new GIcon(G_DEFAULT_ICON);
blueIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png";

// Set up our GMarkerOptions object
markerOptions = { icon:blueIcon };

// add the markerOptions as the second param to GMarker constructor
map.addOverlay(new GMarker(latlng, markerOptions));

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

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