我可以将2个cameraUpdate与一个animateCamera一起使用吗? [英] Can I use 2 cameraUpdates with one animateCamera?

查看:43
本文介绍了我可以将2个cameraUpdate与一个animateCamera一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试放大地图

CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(mBounds, this.getResources().getDisplayMetrics().widthPixels,
                        height, padding);
mMap.animateCamera(cameraUpdate, duration, null); 

然后我要垂直滚动地图

CameraUpdate cameraUpdate =
        CameraUpdateFactory.scrollBy(0, amountToScroll);
    mMap.animateCamera(cameraUpdate, duration, null);

问题是...它不起作用.如果在缩放后立即调用滚动条,则仅考虑滚动条.如果缩放动画结束后滚动地图,我将有2个动画.

The thing is ... it is not working. If I call the scroll right after the zoom, only the scroll is taken into account. If I scroll the map once the zoom animation is finished I will have 2 animations.

我想用相同的动画进行这两种操作,这有可能吗?

I would like to do both operations with the same animation, is it possible?

推荐答案

如果多次调用 animateCamera ,则只有最后一个会完成其操作.

If you call animateCamera multiple times, only the last one will finish its action.

简单的解决方法是使用 moveCamera 而不是第一次调用 animateCamera ,但是从UX角度来看,这不是一个很好的解决方案.

The easy fix would be to use moveCamera instead of the first call to animateCamera, but that's not a nice solution from UX perspective.

另一种方法是自己进行数学运算,并用您真正想要显示的界限填充 mBounds .

The other way would be to do the math yourself and fill mBounds with the bounds you really want to show.

这篇关于我可以将2个cameraUpdate与一个animateCamera一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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