How to center map on marker click to show whole InfoWindow

Drake29a picture Drake29a · Apr 19, 2013 · Viewed 7.5k times · Source

Ok, by default on marker click, marker is centred on the map. The problem is, that i have high infoView, inflated from layout, and it show out of map bounds. What can i do, to center pin horizontaly, and position it below map center, to make infoWindow visible.

Answer

Drake29a picture Drake29a · Apr 19, 2013

So I ended up with this solution, it works like a charm. I`m opening infoWindow after animation.

int zoom = (int)map.getCameraPosition().zoom
CameraUpdate cu = CameraUpdateFactory.newLatLngZoom(new 
LatLng(arg0.getPosition().latitude + (double)90/Math.pow(2, zoom), 
arg0.getPosition().longitude), zoom);
map.animateCamera(cu,500,null);