如何取消Google地图的任何移动?
How to cancel any movement of Google Map?
我的应用程序中有一个名为 map.animateCamera(...)
的地方。
我想取消地图的任何移动。我正在寻找类似 map.cancelCameraMove()
或类似的东西,但不幸的是,它不存在。
有什么帮助吗?
看来 map.stopAnimation()
是您需要的:
...
map.animateCamera(location, duration, null);
...
// when need to stop animation
map.stopAnimation();
或者您可以使用解决方法:通过 map.getCameraPosition()
and move it instantaneous exactly to them with map.moveCamera()
获取当前相机位置。类似的东西:
...
map.animateCamera(location, duration, null);
...
// when need to stop animation
CameraPosition cameraPosition = map.getCameraPosition();
map.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
我的应用程序中有一个名为 map.animateCamera(...)
的地方。
我想取消地图的任何移动。我正在寻找类似 map.cancelCameraMove()
或类似的东西,但不幸的是,它不存在。
有什么帮助吗?
看来 map.stopAnimation()
是您需要的:
...
map.animateCamera(location, duration, null);
...
// when need to stop animation
map.stopAnimation();
或者您可以使用解决方法:通过 map.getCameraPosition()
and move it instantaneous exactly to them with map.moveCamera()
获取当前相机位置。类似的东西:
...
map.animateCamera(location, duration, null);
...
// when need to stop animation
CameraPosition cameraPosition = map.getCameraPosition();
map.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));