怎样才能实现拖放为Android标志? [英] How does one implement drag and drop for Android marker?

查看:94
本文介绍了怎样才能实现拖放为Android标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好? 我的工作在Android的一个图形页面的应用程序。我有,我希望能够使用谷歌地图API上的getLocation功能,后来三个标记。为了尝试一下,我想移动标记用拖放功能,然后检查位置。

Hi? I am working on a MapView app in Android. I have three markers that I want to be able to use the Google Map API getlocation-function on, later on. In order to try it out I would like to move the marker with a drag and drop-function, and then check the location.

任何人谁得到了拖放工作在Android标记,或知道的方式开始想出来的?

Anyone who has gotten a drag and drop to work on an android marker, or know a way to start figuring it out?

/ AK

推荐答案

这里是一个示例从项目我的书显示在Android的一个谷歌地图标记拖和下降的运动之一。

Here is a sample project from one of my books showing drag-and-drop movement of markers on a Google Map in Android.

在简单地说,它使用了的onTouchEvent()来检测,当用户触摸并保持自己的手指附近的一个标志。然后,它会删除覆盖的盯防,但是把同样的图像上使用地图 RelativeLayout的的顶部。然后,在移动触摸事件,图像移动(不是强迫全覆盖重绘更快)。当手指提起时,图像被删除,但该标记放回覆盖在新的专

In a nutshell, it uses onTouchEvent() to detect when the user touches and holds their finger near a marker. It then removes the marker from the overlay, but puts the same image over top of the map using RelativeLayout. Then, on "move" touch events, the image is moved (faster than forcing the whole overlay to redraw). When the finger is lifted, the image is removed, but the marker is put back in the overlay at the new spot.

这篇关于怎样才能实现拖放为Android标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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