How to distinguish between move and click in onTouchEvent()?

后端 未结 10 2149
暖寄归人
暖寄归人 2020-11-28 22:30

In my application, I need to handle both move and click events.

A click is a sequence of one ACTION_DOWN action, several ACTION_MOVE actions and one ACTION_UP action

10条回答
  •  旧时难觅i
    2020-11-28 23:24

    It's very difficult for an ACTION_DOWN to occur without an ACTION_MOVE occurring. The slightest twitch of your finger on the screen in a different spot than where the first touch occurred will trigger the MOVE event. Also, I believe a change in finger pressure will also trigger the MOVE event. I would use an if statement in the Action_Move method to try to determine the distance away the move occurred from the original DOWN motion. if the move occurred outside some set radius, your MOVE action would occur. It's probably not the best, resource efficient way to do what your trying but it should work.

提交回复
热议问题