Is there any way how can I intercept/decorate view's touch event without extending View
or wrapping in some ViewGroup
(which can intercept child events)?
Suppose I have ExpandableListView
which handles item click events. If I set in adapter OnClickListener
or OnTouchListener
on inflated item view returned by adapter, ExpandableListView
does not perform corresponding action (group expanding) as event was consumed by item's listener.
The reason why I do not want to use ExpandableListView#setOnItemClickListener
is, that I want to decorate click event in adapter without using ExpandableListView
dependency.
I found a working solution for this problem.
Solution: collecting event clones in
OnTouchListener
and then dispatching them to parent view.Dispatch method:
Helper class