谷歌地图在android系统 [英] google maps in android

查看:113
本文介绍了谷歌地图在android系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是谷歌地图API的Andr​​oid操作系统的新用户。我曾在我使用谷歌地图的小应用程序。我想添加一个功能,当我在地图上双击(多点触摸)地图应该放大。是否有任何人谁拥有一个想法如何做到这一点,或者如果有可能,请provid一个code例子。
先谢谢了。

I am a new user of google maps API in android OS. I have made a small application in which i am using google maps. I want to add a functionality that when i double click (multi touch) on a map the map should zoom in. IS there anybody who has an idea how to do this or if it is possible please provid a code example. Thanks in advance.

BR,
无声codeRS

BR, SilentCoders

推荐答案

我做了这样的事情在使用地图API的应用程序。虽然我这样做在覆盖项目,原则应该是相同的。

I've done something like this in an app using maps api. Although I did this in an overlay item, the principle should be the same.

您可以尝试使用TouchListener和GestureDetector来检测触摸事件和这样的。

You could try using TouchListener and GestureDetector to detect the touch events and such.

请注意,这不是所有的实际工作code,则需要使其适合您的实现采用它。

Note that this is not all actual working code, you need to adopt it so it fits into your implementation.

...
class MyDetector extends SimpleOnGestureListener {
    @Override
    public boolean onDoubleTap(MotionEvent event) {
        mapView.getController().zoomInFixing((int) event.getX(), (int) event.getY());
        return super.onDoubleTap(
    }
}


// maybe do this in your init or something
GestureDetector gDetector = new GestureDetector(new MyDetector());
mapView.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return gDetector.onTouchEvent(event);
    }
});

类似的东西应该的工作:)

Something like that "should" work :)

这篇关于谷歌地图在android系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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