In Android, we can set OnClickListeners for views.
But how do we intercept the location of the touch event?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
there is method in
ActivityEdit: Or you can define
OnTouchListenerfor anyViewand can use its methodEdit2: the
xandyvalues depends upon the method call. If you useonTouchEvent()ofActivitythen it indicates that noViewconsumes the touch event see documentation and if you handle it on anyViewthen the x and y will be according to theView‘s area.