Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Google Maps v2 - set zoom level for myLocation

Is it possible to change the zoom level for myLocation with the new Google Maps API v2?

If you set GoogleMap.setEnableMyLocation(true);, you get a button on the map to find your location.

If you click on it, then the map will bring you to your location and zoom it in to some level. Can I change this zoom to be less or more?

like image 660
dumazy Avatar asked Oct 09 '22 10:10

dumazy


People also ask

How do I change the default zoom on Google Maps?

You can change the zoom level of the map using simple steps. Step 1 Go to Add or Edit Map page . Step 2 Select 'Default zoom level' in the 'Map Information section'. Step 3 click save map and see the changes.

How do I change the max zoom level in Google Maps?

Setting up the minimum or maximum Zoom value for Google Maps can be done by adding the shortcode attribute with Store Locator Shortcode. Furthermore, the maximum value of Google Maps Zoom level is 22. Therefore, the defined maximum value must be below or equal to 22, which is the default.

How do you zoom in slightly on Google Maps?

Zoom in the mapDouble tap a spot on the map, and then: Drag down to zoom in. Drag up to zoom out.

How do I zoom a lot on Google Maps?

First of all, search for a place on Google Maps. After you get the result, switch to the Satellite view by clicking the square icon (with “Satellite” as its caption) on the bottom-left of the map screen. Now zoom in using the + (plus) button present on the right-bottom of the map screen.


1 Answers

It's doubtful you can change it on click with the default myLocation Marker. However, if you would like the app to automatically zoom in on your location once it is found, I would check out my answer to this question

Note that the answer I provided does not zoom in, but if you modify the onLocationChanged method to be like the one below, you can choose whatever zoom level you like:

@Override
public void onLocationChanged(Location location) {
    if( mListener != null ) {
        mListener.onLocationChanged( location );

        //Move the camera to the user's location and zoom in!
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()), 12.0f));
    }
}
like image 238
DiscDev Avatar answered Oct 18 '22 23:10

DiscDev