双击:缩放 Android MapView?
经过一些工作后,我的路线应用程序运行良好。 我唯一想添加的是双击放大功能,但我不知道如何添加。
你能给我一个提示吗?
After a little bit of work my route application works fine.
The only thing I just want to add is a double tap zoom in function, but I don't know how.
Could you give me a hint?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我也一直在寻找答案/示例,但找不到有效的代码。
最后,这是对我有用的代码:
MyMapActivity.java
OnDoubleTap.java
main.xml
不要忘记在此处替换
android:apiKey
值与您的apiKey
。I've also been searching for an answer/example, but found nowhere working code.
Finally, here's the code that's working for me:
MyMapActivity.java
OnDoubleTap.java
main.xml
Don't forget to replace here the
android:apiKey
value with yourapiKey
.实现 GestureListener 以接收 doubleTap 事件。
请参阅:网格布局上的 Fling 手势检测
Implement GestureListener to receive doubleTap events.
see: Fling gesture detection on grid layout
这是一个很好的、简明扼要的实现:
Double Tap Zoom in GoogleMaps Activity
(对于所有对这个问题犹豫不决的人来说,这是一个迟到的答案)
Here is a nice and down-to-the-point implementation:
Double Tap Zoom in GoogleMaps Activity
(a late answer for all those that stuble over this question)
我知道这是一篇旧文章,但这个解决方案也有效: 双击/点击地图缩放 ( Android)
我认为他在自己的帖子中修复了错误,所以只需使用问题部分,而不是答案(它们太可怕了:))
An old post, I know, but this solution works too: double click/tap map zoom (Android)
I think he fixed his errors in his own post, so just use the question part, not the answers (they are horrible :))
当您想要放大和缩小时,请使用以下代码
Use the following code when you want to zoom in and zoom out
如果有人正在寻找新 GoogleMap 的答案(自 Google-Play-service:9+ 起)
In case somebody is looking for the answer for the new GoogleMap (Since Google-Play-service:9+)