Android ontouch and onclick conflict resolution

  Hello everyone, as an Android developer, at the moment of solving the demand this afternoon, I happened to use both ontouch and onclick events in the project, and then the onclick click background animation did not show up at runtime, and finally I knew the problem Yes: onclick was overwritten by ontouch's MotionEvent.ACTION_DOWN MotionEvent.ACTION_MOVE MotionEvent.ACTION_CANCEL MotionEvent.ACTION_UP        gestures, causing onclick to not respond. Then I found the problem, just return false in the ontouch return part, and then continue to execute the action event below. The default is return true. I hope this post of mine can help everyone, thank you

Guess you like

Origin blog.csdn.net/qq_41943812/article/details/105794552