简体   繁体   English

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

[英]How to remove border from google map infobox?

I have tried with several guides and stackoverflow questions to find out a solution for remove the extra space from info windows. 我尝试了一些指南和stackoverflow问题,以找到解决方案,以从信息窗口中删除多余的空间。 My map looks like below. 我的地图如下所示。 Help me to get rid of this. 帮我摆脱这个。 I just need to show the image with a small border on the map. 我只需要在地图上显示带有小边框的图像即可。

在此处输入图片说明


Here is the js for adding those info windows. 这是添加这些信息窗口的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);
    }
}

tried with closeBoxMargin: "10px 20px 2px 2px", closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif", but not working for me. 尝试使用closeBoxMargin: "10px 20px 2px 2px", closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif",但对我不起作用。

Thanks in advance. 提前致谢。

Try the infobubble js here http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble.js 在此处尝试infobubble js http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble.js

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

You can use 您可以使用

// 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';

In InfoWindowAdapter change to 在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;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM