2013-01-03 83 views

回答

0

OK

我發現的情況下,任何人需要它的答案。

我只是用MarkerImage那樣:

var image = new google.maps.MarkerImage(icon, 
    // This marker is 20 pixels wide by 32 pixels tall. 
    null, 
    // The origin for this image is 0,0. 
    new google.maps.Point(0,0), 
    // The anchor for this image is the base of the flagpole at 0,32. 
    new google.maps.Point(7, 7) 
); 
var marker = new google.maps.Marker({ 
    position: new google.maps.LatLng(lat, lon), 
    map: map, 
    title: title, 
    icon: image 
}); 

其中新google.maps.Point(7,7)取入的像素偏移量。

初始位置0,0落在標記的中心底部,所以我將圖像偏移一半寬度和高度。

現在完美運作。