2016-11-25 185 views
-3

我已經實現谷歌地圖到我的應用程序。我在當前位置添加了自定義標記。我想隨着用戶移動標記以及地圖一起移動標記。我想實現谷歌地圖導航中的功能。雖然谷歌搜索我發現了以下鏈接,但沒有得到結果。所以任何人都可以幫助我?隨着用戶移動沿着地圖移動標記

我在onLocationChanged加入這個()

LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); 
     sourceLocation = latLng; 
     startPoint = new GeoPoint(latLng.latitude,latLng.longitude); 
     forNavigation = location; 

     // animation 
     mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); 
     // Zoom in the Google Map 
     mMap.animateCamera(CameraUpdateFactory.zoomTo(15)); 
     // mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mPositionMarker.getPosition(), 15)); 
     mMap.animateCamera(CameraUpdateFactory.newLatLng(new LatLng(location 
       .getLatitude(), location.getLongitude()))); 

這些是我發現 Google map: moving marker and map together smoothly along with user?

How to smoothly keep moving current location marker in Google Maps v2 android

回答

0

這裏是二的解決方案,你有聯繫。

  1. 使用onlocationtrue然後它顯示你的藍點作爲你當前的位置。

  2. 對當前位置使用融合api並在locationchanged中創建標記。

對於融合的API你可以從here檢查。

謝謝