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.
An InfoWindow can be placed on a map at a particular position or above a marker, depending on what is specified in the options. Unless auto-pan is disabled, an InfoWindow will pan the map to make itself visible when it is opened. After constructing an InfoWindow, you must call open to display it on the map.
Move an info windowAttach the info window to a new marker using the InfoWindow. open() method. Note: If you call open() without passing a marker, the InfoWindow will use the position specified upon construction through the InfoWindowOptions object literal.
Initialize google. maps. InfoWindow() for info windows popup. Loop through the locations (markers) and set the marker position with options (position, map, title, etc.)
addListener(marker, 'click', (function(marker, i) { return function() { infowindow. setContent(locations[i][0]); infowindow. open(map, marker); } })(marker, i)); iconCounter++; } function AutoCenter() { // Create a new viewpoint bound var bounds = new google. maps.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With