Reputation: 969
I have a linear layout with few child components in it. I have onTouchListener on the linearlayout. I want onTouch event to trigger when I touch child components of the linear layout too.
Upvotes: 4
Views: 4177
Reputation: 16206
You should be able to implement the onInterceptTouchEvent method in a custom subclass of LinearLayout to achieve that effect. From the documentation:
public boolean onInterceptTouchEvent (MotionEvent ev)
Implement this method to intercept all touch screen motion events. This allows you to watch events as they are dispatched to your children, and take ownership of the current gesture at any point.
Upvotes: 3