如何从谷歌地图信息框中删除边框?

时间:2014-06-06 11:01:16

标签: javascript css google-maps

我尝试了几个指南和stackoverflow问题,找出一个解决方案,从信息窗口中删除额外的空间。我的地图如下所示。帮我摆脱这个。我只需要在地图上用小边框显示图像。

enter image description here


以下是添加这些信息窗口的js。

function addBasicInfoWindow(map, marker, contentStr) {
    var infoWindowOptions = {
            content: contentStr,
            pixelOffset: new google.maps.Size(0, 15),
            disableAutoPan: false,
            zIndex: 50,
        };
    try {
        basicInfowindow = new google.maps.InfoWindow(infoWindowOptions);
        basicInfowindow.open(map,marker);
    } catch (ex) {
        alert(ex);
    }
}

尝试了closeBoxMargin: "10px 20px 2px 2px", closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif",,但没有为我工作。

提前致谢。

2 个答案:

答案 0 :(得分:1)

在这里试试infobubble js http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble.js

现场演示: http://google-maps-utility-libraryv3.googlecode.com/svn/trunk/infobubble/examples/example.html

您可以使用

// Close button


var close = this.close_ = document.createElement('IMG');
  close.style['position'] = 'absolute';
  close.style['width'] = this.px(12);
  close.style['height'] = this.px(12);
  close.style['border'] = 0;
  close.style['zIndex'] = this.baseZIndex_ + 1;
  close.style['cursor'] = 'pointer';
  close.src = 'http://maps.gstatic.com/intl/en_us/mapfiles/iw_close.gif';

答案 1 :(得分:0)

在InfoWindowAdapter中更改为

@Override
    public View getInfoWindow(Marker marker) {
        View view = ((Activity)context).getLayoutInflater()
                .inflate(R.layout.map_custom_infowindow, null);
        return view;
    }

    @Override
    public View getInfoContents(Marker marker) {

        return null;
    }