我希望谷歌地圖在我的應用程序總是被完全集中於用戶,並與他們作爲移動他們的當前位置的變化。 (想想口袋妖怪去,怎麼地圖實際上是與用戶移動)鎖定谷歌地圖上的用戶位置
我目前最好的實現只用動畫每次更新相機位置的位置改變,像這樣:
// update the location of the camera based on the new latlng, but keep the zoom, tilt and bearing the same
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(new CameraPosition(latLng,
googleMap.getCameraPosition().zoom, MAX_TILT, googleMap.getCameraPosition().bearing));
googleMap.animateCamera(cameraUpdate);
googleMap.setLatLngBoundsForCameraTarget(toBounds(latLng, 300));
然而,這使得相機運動有點波動,並且落後於實際的用戶位置標記,特別是當用戶快速移動時。
有沒有一種方法,以配合谷歌地圖攝像頭的運動,因此它完全用戶的運動相匹配?
謝謝您!工作得很好。 – Dportology