My custom infoWindows are larger than the default. This means I have to lower the point in which the map centers upon clicking a marker, so that the infoWindow will be shown fully. The problem is, since I move the map position down by a specific amount of latitude, when the map is zoomed in close, the offset is too great. Inversely, when the I zoom far out, it doesn't move down enough. How can I position the infoWindow relative to the screen height?
Default look of screen. X is anchor of infoWindow
|-----|
|-----|
|--X--|
|-----|
|-----|
What I want: (No matter the zoom level)
|-----|
|-----|
|-----|
|--X--|
|-----|
To lower the point at which the map centers on a marker can be done. Sorry but you loose the default info window implementation. Don't worry your custom info window will easily port to this method. This is a very good thing to handle onMarkerClick
because now your info window can handle buttons link to external content, anything the info windows do on the google maps application like a nav button can be done at onMarkerClick() with a popup window or dialog fragment.
Follow these steps.
mMap.setOnMarkerClickListener(this);
mMap.moveCamera(CameraUpdateFactory.newLatLng(markers newlat newlon));
return false;
from the onMarkerClick event to tell android your
handling the marker.Note return true from onMarkerClick() for markers you want to use the default map info window.