android - How to find the source view of a MotionEvent ACTION_CANCEL -
how can find view causing motionevent action_cancel? have view "a" receiving action_cancel , don't want happen. somewhere, view "b" "consuming" motionevent. i'm hoping there way find out "b" can address misfunctionality.
i've tried looking through code various ontouchevent() , onintercepttouchevent() handlers haven't yet found culprit.
i've put break point @ problematic action_cancel not able recognize in motionevent might represent "b".
if parent intercepting motion event, way prevent prevent parent intercepting event. can managed in 2 ways.
without seeing specific code , wanting generalised solution suggest following.
i suggest managing touch events parents , child managing the
requestdisallowintercepttouchevent(boolean) ,
onintercepttouchevent(android.view.motionevent) event handlers of every view/viewgroup within affected views a, b c.
by disallowing parent intercepts in child, assists in catching parent intercepts haven't accounted for, , customise , vary child elements within 1 parent.
this must managed highest parent of view/viewgroup , managed through parent , child relationships.
checking listviews, element has inbuilt touch events.
android.com/training/gestures/viewgroup
in terms of finding offending view intercepting event, cannot answered except logic of:
go through each parent child/parent child view. methodically check ontouch handling within each view/view group shown in diagram.
there more detail in these answers here:
https://stackoverflow.com/a/30966413/3956566
https://stackoverflow.com/a/6384443/3956566
i'm sure understand this, me, it's simplest solution.
beyond this, we'd need @ code troubleshoot it.
Comments
Post a Comment