繁体   English   中英

Android Google Maps动画每个位置

[英]Android Google Maps animating every location

我有一个LatLng的ArrayList,并且在onMapReady(GoogleMap googleMap)的forloop中,我希望对从位置到另一个的移动进行动画处理。

我尝试在for循环中执行此操作:

        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(currLatLng,10), 1000, null);

而动画仅发生在最后一个位置。

我将如何去做? 我应该使用animateCamera()方法的最后一个参数吗? (可取消的回调)

我的直觉是正确的。
animateCamera的最后一个参数是CancellableCallback()接口。
我所做的是使一个名为nimateToLocationAtIndex(int index)

然后调用:

mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 10), 2000, new GoogleMap.CancelableCallback() {
        @Override
        public void onFinish() {
            // Placing a marker on the position after animated
            Marker marker = mMap.addMarker(markerOptions);
            animateLocationMovement(i+1);
        }

尽管我遇到了另一个问题,即下一个位置的地图没有加载,所以看起来好像动画很慢,但这可以根据需要对位置进行动画处理。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM