Change the margin color of InfoWindow view of marker in google maps api v2

我怕爱的太早我们不能终老 提交于 2019-12-30 06:12:11

问题


Hello I try to change the default color that have (white) to black, this in the google maps api v2, anyone know how I can do this?

PD: is the margin of infowindow

this is my code where I change the content of infowindow but need change the margin :S

 GoogleMap map = ....
    map.setInfoWindowAdapter(new InfoWindowAdapter() {

            @Override
            public View getInfoContents(Marker marker) {
                View v = getLayoutInflater().inflate(   
                        R.layout.info_window_layout, null);
                v.setBackgroundColor(Color.BLACK);
                return v;
            }
        });

thanks for reply


回答1:


Use getInfoWindow instead of getInfoContents to provide full info window. Make sure to set appropriate backgrounds for root view, e.g. something with a triangle at the bottom center.




回答2:


In InfoWindowAdapter change to

@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;
    }


来源:https://stackoverflow.com/questions/18282718/change-the-margin-color-of-infowindow-view-of-marker-in-google-maps-api-v2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!