2016-03-23 33 views
0

SupportMapFragment'un yakınlaştırma seviyesini nasıl ayarlayabilirim? bu bir teklif Rob adlı adamı satın cevap gibi ben benzer sorular bulundu bazı cevaplar çalıştı:SupportMapFragment set google maps Zoom seviyesi

LatLng currentLocation = mService.getCurrentLocation(); 
    CameraPosition cameraPosition = new CameraPosition.Builder() 
      .target(currentLocation) // Sets the center of the map to the current location of the user 
      .zoom(17)     // Sets the zoom 
      .bearing(90)    // Sets the orientation of the camera to east 
      .tilt(30)     // Sets the tilt of the camera to 30 degrees 
      .build();     // Creates a CameraPosition from the builder 
    mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); 

Ama bu çözüm işe yaramadı. Yani, SupportMapFragment kullandığımı bilerek Zoom seviyesini nasıl ayarlayabilirim. Geçerli konum sonra bu kodu deneyin boş değilse

cevap

1

o

LatLng currentLocation = mService.getCurrentLocation(); 
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(currentLocation , 16); 
mMap.addMarker(new MarkerOptions().position(location).title("")); 
mMap.moveCamera(CameraUpdateFactory.newLatLng(currentLocation)); 
mMap.animateCamera(cameraUpdate) 
+0

Thx Mustanser çalışacaktır :) bu iyi çalışır – TeachMePls

1
Marker currentMarker; 

    MarkerOptions marker = new MarkerOptions().position(new 
        LatLng(Double. 
        parseDouble(lat),Double.parseDouble(lon))).title(title); 
        marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_schoolbus)); 
        currentMarker = map.addMarker(marker); 
        currentMarker.showInfoWindow(); 
        currentMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.ic_schoolbus)); 
        map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Double.parseDouble(lat),Double.parseDouble(lon)), 15)); 
+0

size Sarika ederiz: D – TeachMePls

+0

hoş geldiniz :-) –