[ACCEPTED]-Android Touch event on screen-touch
Accepted answer
try this code
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
return super.onTouchEvent(event);
}
0
The problem you might have when using the 9 onTouchEvent()
is that because of your view hierarchy 8 where you also have other views on top of 7 your activity, touches on views that override 6 this event (buttons, edittext etc) will 5 not go down to you activity anymore and 4 you will not receive them.
You should use 3 dispatchTouchEvent()
instead as this propagates the other way 2 around, from the activity to your other 1 views and always gets called.
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
// Your code here
return super.dispatchTouchEvent(ev);
}
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.