android - Zooming for the markers near the top of the map -
i have implemented below code zooming on location markers when user click on them. works fine markers except marker near top or bottom of map. zooming markers near top , bottom of map not @ exact place.as map first animate camera marker comes @ center of screen , zoom @ center of screen, markers near top not able come @ center , that's why zoom not @ exact location.is there way can resolve this?
googlemap.setonmarkerclicklistener(new googlemap.onmarkerclicklistener() { @override public boolean onmarkerclick(final marker marker) { cameraupdate center= cameraupdatefactory.newlatlng(marker.getposition()); cameraupdate zoom=cameraupdatefactory.zoomto(6); });
i tried below code same issue-
googlemap.animatecamera(cameraupdatefactory.newlatlng(marker.getposition())); googlemap.animatecamera(cameraupdatefactory.zoomby(2));
try following method, have tried , works, can not tell if meets requirement:
googlemap.setonmarkerclicklistener(new googlemap.onmarkerclicklistener() { @override public boolean onmarkerclick(final marker marker) { // cameraupdate center= // cameraupdatefactory.newlatlng(marker.getposition()); // cameraupdate zoom = cameraupdatefactory.zoomto(6); // return true; googlemap.movecamera(cameraupdatefactory.newlatlngzoom(marker.getposition(),15)); // zoom in, animating camera. googlemap.animatecamera(cameraupdatefactory.zoomin()); // zoom out zoom level 10, animating duration of 2 seconds. googlemap.animatecamera(cameraupdatefactory.zoomto(15), 2000, null); return true; } });
Comments
Post a Comment