Android的:如何使onTouch工作一样的onClick? [英] Android: How to make onTouch work like onClick?

查看:159
本文介绍了Android的:如何使onTouch工作一样的onClick?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这个教程 http://mobiforge.com/developing/story/使用 - 谷歌 - 地图 - 机器人显示地图视图和设置onTouch事件显示敬酒消息(经/纬度),当我点击一个特定区域。现在我的问题是,吐司消息显示我触摸即使是移动地图画面的那一刻?我只想显示如果触摸按下的位置,触摸起来一点是相同的敬酒。如何实现呢?

I used this tutorial http://mobiforge.com/developing/story/using-google-maps-android to display Map view and set onTouch event to display a toast message (latitude/longitude) when I click on a particular area. Now my problem is that the Toast message is displayed the moment I touch the screen even if it is to move the map? I want to display the toast only if the touch down point and touch up point are the same. How do I implement that?

推荐答案

检查此举位在的 MotionEvent

if(event.getAction() & MotionEvent.ACTION_MOVE == MotionEvent.ACTION_MOVE)

这篇关于Android的:如何使onTouch工作一样的onClick?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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