1
votes

I implemented perfect answer of chose007 to make InfoWindow over Google Maps API2 clickable in my app. The only problem is, that I would like to make InfoWindow transparent (to make it bubble shaped). I can do it with non-interactive InfoWindow using style wrapper:

gMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

        @Override
        public View getInfoWindow(Marker marker) {

           ContextThemeWrapper cw = new ContextThemeWrapper(
                 getApplicationContext(),R.style.TransparentDialog);
              LayoutInflater inflater = (LayoutInflater) cw
                 .getSystemService(LAYOUT_INFLATER_SERVICE);
           View layout = inflater.inflate(R.layout.map_bubble,
                 null);
           return layout;
        }

The InfoWindow appears as transparent, but it is not possible to set the contents of the window in:

 @Override
         public View getInfoContents(Marker marker) {
            // Setting up the infoWindow with current's marker info
         TextView bubHd = (TextView) infoWindow.findViewById(R.id.bubble_hd);
         bubHd.setText(places.get(placeId).getTitle());
           .
           .
           .

And it is not more interactive as the interactivity is also set inside getInfoContents and it seems to me, that this method is not called at all if getInfoWindow returns non null result.

Does anybody know, how to make the interactive InfoWindow over Google Maps transparent?

1

1 Answers

2
votes

The InfoWindow appears as transparent, but it is not possible to set the contents of the window in getInfoContents()

Correct. If getInfoWindow() returns a non-null value, you are supposed to return the complete info window with the complete contents, and getInfoContents() will not be called. Move your getInfoContents() method body statements into getInfoWindow().