Android Map:如何在Map上制作折线动画? [英] Android Map: How to animate polyline on Map?

查看:134
本文介绍了Android Map:如何在Map上制作折线动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从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

推荐答案

您也可以尝试使用此参考 https://github.com/mohak1712/UberUX?utm_source = android-arsenal.com& utm_medium = referral& utm_campaign = 6129

You can try with this reference also https://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上制作折线动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆