3

i'm using the maps v2 in my Android APP

My map is automatically updated every few seconds to show some new points on the map. For every time it refresh, automatically the following event: "setOnCameraChangeListener" is called.

The user can interact with the map by moving the camera or doing the Zoom. I need to intercept the user's gesture on the map such as "Zoom", "Drag", the "Pinch Open" or "Pinch Close".

So I can not use the "OnCameraChangeListener" because this is already done automatically from application when it auto update the data, and I am not able to understand when the event occurs for an automatic update of the map or when by user interaction

How do I trap these this user gesture?

4

2 回答 2

5

自动调用以下事件:“setOnCameraChangeListener”。

没有什么是自动完成的。

每隔几秒钟更新一次,以在地图上显示一些新点。

和:

然后重新调整缩放以适合地图上的实际标记。

这似乎是一种非常糟糕的用户体验:当他们只想滑动到非洲时,强迫用户查看您的标记。

无论如何,如果您GoogleMap.animateCamera的代码中有调用,您可以使用CancelableCallback参数来帮助您区分用户活动和代码调用导致onCameraChange. 有关如何实现此目的,请参阅有关 gmaps-api-issues 的评论。

于 2013-05-20T18:12:04.927 回答
0

尝试在处理自动更新的代码块中调用自动更新后所做的任何事情,而不是在OnCameraChangeListener. 然后使用OnCameraChangeListenerto 执行仅在相机实际移动时才应执行的操作(无论是由用户引起还是由您的代码引起)。

于 2013-05-20T12:44:15.653 回答