event handling - Android child onTouchListener disabling parent onClick -


i have parent, custom relativelayout inflates 2 imageviews: 1 content image, , close button in top right corner.

the issue: cannot have both gestures/scaling of content image functioning , close button functioning.

the content image custom imageview subclass (a modification of https://github.com/mikeortiz/touchimageview), has it's own ontouchlistener allow pinch-zooming, , responding usual gestures. ontouchlistener contains code:

private class privateontouchlistener implements ontouchlistener {     @override     public boolean ontouch(view v, motionevent event) {         mscaledetector.ontouchevent(event);         mgesturedetector.ontouchevent(event);         //....         return true; 

now, if return true, scaling/gestures content image works, close button onclick never called, whereas if it's false scaling/getures don't work , onclick can called.

i don't understand why return function called after event passed gesture detector affects (?consumes event) whether or not gesture detector works. there simple way of ensuring functionality of both child imageviews, return function false both detectors still work?

what i've tried:

  • ensuring methods in gesturedetector return false, event isn't consumed. (the scaledetector isn't custom, haven't done same there; if think that's problem let me know)

  • an onintercepttouch method in parent relativelayout, i'm not sure if implemented correctly

  • (reading around event handling understand how works)


Comments

Popular posts from this blog

Add new key value to json node in java -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

javascript - Highcharts Synchronized charts with missing data points -