2013-04-24 96 views
1

我已經tryied像[2 Lat Long網詳情]Android的谷歌地圖V2想顯示2市場顯示

   final LatLng latlong = new LatLng(lat,lng); 
       final LatLng latlongcr = new LatLng(currentlat,currentlong); 

       mapView.addMarker(new MarkerOptions().position(latlongcr).title("Here You Are")); 
       mapView.addMarker(new MarkerOptions().position(latlong).title(addr)); 

       mapView.moveCamera(CameraUpdateFactory.newLatLngZoom(latlong, 20)); 
       mapView.moveCamera(CameraUpdateFactory.newLatLngZoom(latlongcr, 20)); 
       mapView.animateCamera(CameraUpdateFactory.zoomTo(20), 2000, null); 

但只獲得一個標記。要顯示2標記的MapView做工精細

+0

你的代碼是正確的..從這裏https://github.com/dhaval0122/DJ-Android-/blob/只取參考master/getDirectionGoogleMap/src/com/DJAndroid/getDirection/showMaps.java – 2013-04-24 09:53:30

回答

3

嘗試使用LatLngBounds.Builder

LatLngBounds.Builder builder = new LatLngBounds.Builder(); 
builder.include(latlongcr); 
builder.include(latlong); 
LatLngBounds bounds = builder.build(); 
mapView.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20)); 
+0

+1回覆讓我檢查 – 2013-04-24 09:53:30