Android: GestureDetector won't catch Gestures

筅森魡賤 提交于 2019-12-06 08:16:59

I'm not really sure why, but as soon as I put Overrides for ALL of the possible gestures in a SimpleOnGestureListener it started working. Apparantly it needed them all in there, not just onFling.

sax

This is not needed what you probably also did and what makes it work for you is that your activity override the onTouchEvent somtehing like this:

@Override
public boolean onTouchEvent(MotionEvent event) {
  if (myGestureDetector.onTouchEvent(event)) {
    return true;
  } else {
    return false;
  }
}

I found the answer on this excellent site.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!