Drake29a Drake29a - 1 year ago 153
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 Source
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download