问题描述
当我从A点-> B点在地图上绘制多段线时,我需要绘制带有动画的多段线.就像从A-> B一样,折线仍在继续绘制.
When I plot my polyline on Map from point A -> B, I have a requirement to draw the polyline with animation. As if from A-> B the polyline keeps on drawing.
我已使用以下链接进行参考:
I have used below link for reference:
https://github.com/amalChandran/google-maps-route-animation
使用该解决方案,我可以对折线进行动画处理,但是折线本身不合适.它没有通过道路.该解决方案的原始APK也具有相同的错误.
Using the solution I am able to animate the polyline, but the polyline itself is not proper. It doesn't go through road. Original APK of the solution also has the same bug.
有人可以帮助我提供合适的解决方案
Can someone pls help me with a suitable solution
推荐答案
You can try with this reference alsohttps://github.com/mohak1712/UberUX?utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=6129
ValueAnimator-用于设置叠加层和折线的动画
ValueAnimator - For animating overlays and polylines
ValueAnimator tAnimator = ValueAnimator.ofFloat(0, 1);
tAnimator.setRepeatCount(ValueAnimator.INFINITE);
tAnimator.setRepeatMode(ValueAnimator.RESTART);
tAnimator.setInterpolator(new LinearInterpolator());
tAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
// animate here
}
});
PolyLines-用于在地图上绘制线
PolyLines - For drawing lines on map
PolylineOptions greyOptions = new PolylineOptions();
greyOptions.width(10);
greyOptions.color(Color.GRAY);
greyOptions.startCap(new SquareCap());
greyOptions.endCap(new SquareCap());
greyOptions.jointType(ROUND);
greyPolyLine = mMap.addPolyline(greyOptions);
这篇关于Android Map:如何在Map上制作折线动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!