我在Google地圖上有3 markers
。Polyline路徑上的動畫標記
Two Markers
顯示starting and ending points
下面是使用繪製折線這兩個點之間的代碼:
private void polyLine() {
LatLng starting = new LatLng(##.######, ##.######);
LatLng ending = new LatLng(##.######, ##.######);
PolylineOptions line = new PolylineOptions().add(starting, ending);
mGoogleMap.addMarker(new MarkerOptions().position(starting).title("Start"));
mGoogleMap.addMarker(new MarkerOptions().position(ending).title("End"));
mGoogleMap.addPolyline(line);
}
One Marker
顯示current Location
[HUE_ROSE]
並以animate marker to current location
使用:
@Override
public void onLocationChanged(Location location)
{
Toast.makeText(this, "Location Changed " + location.getLatitude()
+ location.getLongitude(), Toast.LENGTH_LONG).show();
mLastLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
if(ourGlobalMarker == null) { // First time adding marker to map
ourGlobalMarker = mGoogleMap.addMarker(new MarkerOptions().position(latLng)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ROSE)));
MarkerAnimation.animateMarkerToICS(ourGlobalMarker, latLng, new LatLngInterpolator.Spherical());
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18));
} else {
MarkerAnimation.animateMarkerToICS(ourGlobalMarker, latLng, new LatLngInterpolator.Spherical());
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18));
}
}
問題:
Getting Animating Marker, but right side of Polyline
SOLUTION:
How Can I show Animated Marker on Polyline Path
我嘗試了很多找到solution
這一個,但did not find
任何東西,分享你的suggestions
。
看看[this](https://stackoverflow.com/q/40526350/6950238)問題和答案。 –
可以分享截圖和演示項目 –
@PhanVanLinh看到這是我想要在結尾處得到的:stackoverflow.com/questions/46103680/map-and-moving-marker-using-google-maps-api如果可以幫助我解決這個問題,這意味着你回答了兩個問題:)我已經在SO問題中分享了我的最新代碼... – Sophie