2016-11-25 113 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检查。

谢谢