Skip to content Skip to sidebar Skip to footer

Is Possible To Create A Transparent Info Window With Map V2?

Hieveryone, one question.I apply the background of infowindows like this: android:background='#55000000' but there seems to be a white background always behind it, is it possible t

Solution 1:

Implement your own InfoWindowAdapter for custom designing infoWindow

Example code

privatefinal View mWindow;

    publicMarkerAdapter() {
        mWindow = getLayoutInflater().inflate(R.layout.custom_info_window,
                null);
    }

    @Overridepublic View getInfoContents(Marker mark) {

        returnnull;
    }

    @Overridepublic View getInfoWindow(Marker marker) {

        render(marker, mWindow);
        return mWindow;
    }

    privatevoidrender(Marker marker, View view) {
        int badge;
        // Use the equals() method on a Marker to check for equals. Do not// use ==.
        badge = R.drawable.ic_launcher;

        ((ImageView) view.findViewById(R.id.badge)).setImageResource(badge);

        Stringtitle= marker.getTitle();
        TextViewtitleUi= ((TextView) view.findViewById(R.id.title));

        titleUi.setText(title);

        Stringsnippet= marker.getSnippet();
        TextViewsnippetUi= ((TextView) view.findViewById(R.id.snippet));

        snippetUi.setText(snippet);

    }

}

Then call it as

mMap.setInfoWindowAdapter(newMarkerAdapter());

Post a Comment for "Is Possible To Create A Transparent Info Window With Map V2?"