Android Google Maps v2 - set zoom level for myLocation

前端 未结 13 1116
孤城傲影
孤城傲影 2020-12-05 01:39

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 butto

相关标签:
13条回答
  • 2020-12-05 02:15

    You can use

        CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(location.getLatitude(), location.getLongitude()));
        CameraUpdate zoom = CameraUpdateFactory.zoomTo(12);
    
    0 讨论(0)
  • 2020-12-05 02:17

    In onMapReady() Method

    change the zoomLevel to any desired value.

    float zoomLevel = (float) 18.0;
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoomLevel));
    
    0 讨论(0)
  • 2020-12-05 02:19

    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentPlace,15)); This is will not have animation effect.

    0 讨论(0)
  • 2020-12-05 02:21

    Even i recently had the same query....some how none of the above mentioned setmaxzoom or else map:cameraZoom="13" did not work So i found that the depenedency which i used was old please make sure your dependency for google maps is correct this is the newest use this

    compile 'com.google.android.gms:play-services:11.8.0' 
    
    0 讨论(0)
  • 2020-12-05 02:23

    you have to write only one line in maps_activity.xml

    map:cameraZoom="13"
    

    I hope this will solve your problem...

    0 讨论(0)
  • 2020-12-05 02:24

    I tried with "mMap.animateCamera( CameraUpdateFactory.zoomTo( 17.0f ) );" but it didn't work for me. So I used this animation for zooming in on start.

    LatLng loc = new LatLng(33.8688, 151.2093);
    mMap.addMarker(new MarkerOptions().position(loc).title("Sydney"));
    mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(loc, 18), 5000, null);
    
    0 讨论(0)
提交回复
热议问题