10
votes

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

screenshoot of my problem

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

2
Please atach the code snippet, so we can know how are you showing the infowindowLeonardo Sapuy

2 Answers

43
votes

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.

7
votes

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