Prevent Touch Event Theft in Android

In Android, touch events bubble up from child to parents as you would expect. However, a parent can choose to intercept all touch events targeted for one of its children and decide to veto dispatch of the event to the child. Widgets that scroll, like ListView or ExpandableListView, routinely do this to implement scrolling. But, this can lead to all kinds of nasty problems when you embed a child that needs touch gesture within such a parent. For example, adding a ViewPager within a ListView will cause the ViewPager to not work all that well.

Continue reading

Advertisements