I have a layout that contains many views. Is there an easy way to disable all its views click events?
Rather than iterating through all the children view, you can add this function to the parent Layout view
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return true;
}
This will be called before the onTouchEvent
for any child views, and if it returns true
, the onTouchEvent
for child views wont be called at all. You can create a boolean field member to toggle this state on and off if you want.