gIrL
gIrL

Reputation: 139

How to keep open custom infowindow

I want to draw custom infowindow that remains open when map activity launched. Below is the code to keep default marker infowindow open by using marker.showInfoWindow() method. The same i want to do for custom infowindow.

private void drawMarker(){

    latLongi = new LatLng(latitude, longitude);

        Marker marker = map.addMarker(new MarkerOptions()
        .position(latLongi)
        .title(getString(R.string.sometext))
        .snippet(address)
        .icon(BitmapDescriptorFactory
                .fromResource(R.drawable.marker)));

        marker.showInfoWindow();
}

Please help. Thanks

Upvotes: 0

Views: 1166

Answers (1)

Top Cat
Top Cat

Reputation: 2483

Here is a demo

You are also able to customize the contents and design of info windows. To do this, you must create a concrete implementation of the InfoWindowAdapter interface and then call GoogleMap.setInfoWindowAdapter() with your implementation. The interface contains two methods for you to implement: getInfoWindow(Marker) and getInfoContents(Marker). The API will first call getInfoWindow(Marker) and if null is returned, it will then call getInfoContents(Marker). If this also returns null, then the default info window will be used.

The first of these (getInfoWindow()) allows you to provide a view that will be used for the entire info window. The second of these (getInfoContents()) allows you to just customize the contents of the window but still keep the default info window frame and background.

for More refer

Hope it helps

Upvotes: 1

Related Questions