I am using Google maps api v2 in android. I have placed a marker by using latitude and longitude . The marker is shown at correct place , but i want the the map should show area around the marker only .i.e i want to zoom to markers position when the map is shown so it shows nearby region of the marker only..any help would be great.
To fix Google maps zooming problems, for Google maps default zoom you want to know how to change the zoom level on Google Maps. You can change the zoom level by going to the Edit map page and then selecting 'default zoom level' in the map information section and then clicking save map.
The app does this because you're not in navigation mode, you're browsing the route. It zooms out to fit the entire route on your screen when you reorient the device. If you don't want it to zoom, press the navigation button in the lower right corner and optionally switch off voice navigation.
Google Maps - cannot zoom and move at the same time with animateCamera, but can with moveCamera. Bookmark this question. Show activity on this post. I am using Google Maps for Android.
pass your current location in this function where you have placed your marker.
private void moveToCurrentLocation(LatLng currentLocation) { googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLocation,15)); // Zoom in, animating the camera. googleMap.animateCamera(CameraUpdateFactory.zoomIn()); // Zoom out to zoom level 10, animating with a duration of 2 seconds. googleMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null); }
Provide marker position.
private void pointToPosition(LatLng position) { //Build camera position CameraPosition cameraPosition = new CameraPosition.Builder() .target(position) .zoom(17).build(); //Zoom in and animate the camera. mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); }
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