Drake29a Drake29a - 6 months ago 63
Android Question

How to center map on marker click to show whole InfoWindow

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
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);

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