2010.12.10(4)——— android MapView 处理双击事件

在地图上每次都点击放大按钮 再放大 不太好 希望 双击来放大地图

在网上找了一些 大多都是重写onTouchEvent方法
但是 按照网上方法 试了都不行

后来发现 重写dispatchTouchEvent 方法 就好了

/
/处理双击事件@Overridepublic boolean dispatchTouchEvent(MotionEvent ev) {if (ev.getAction() == MotionEvent.ACTION_DOWN) {count++;if(count==1){firstClick = System.currentTimeMillis();}else if(count==2){secondClick = System.currentTimeMillis();if (secondClick - firstClick < 500) {mapView.getController().zoomInFixing((int) ev.getX(),(int) ev.getY());}count = 0;firstClick = 0;secondClick = 0;}}return super.dispatchTouchEvent(ev);}









更多相关文章

  1. android加载字体内存泄漏的处理方法
  2. Android Studio运行main方法报错 SourceSet with name ‘main‘
  3. Android之View和ViewGroup事件分发
  4. 谷歌开发工具android studio启动不了的解决方法
  5. android adb push 与 adb install的比较(两种安装APK的方法)
  6. 解决style attribute ‘@android:attr/windowEnterAnimation’ n
  7. Android 应用程序退出的四种方法
  8. Android 事件触发机制的深入学习
  9. Android绘图之Paint的使用方法详解

随机推荐

  1. 再见已是初识(初十)
  2. Android(安卓)WebView中的JavaScript代码
  3. 从componentWillReceiveProps说起
  4. flexbox布局指南
  5. Mybaitis缓存的优化
  6. 分布式系统架构常见面试知识点梳理(每次面
  7. 图解源码 | SpringBoot中自动配置原理
  8. 单例模式你会几种写法?
  9. 一步为你的Springboot应用自定义banner
  10. 工厂模式理解了没有?