relativelayout - Android: On touch event not received by parent view -


i have relative layout r1 custom view expandable list view.

now inside r1, have 1 image view i1 , relative layout r2, both being siblings.

i have set on click listeners both r2 , i1. , works fine. want move whole custom view r1 on touch conditions. have set ontouchlistener r1. when ever touch list item, never received r1.

i have tried searching nothing works. please me figure out how touch event received r1 , if not use it, should passed on i1 , r2.

thanks, sunny

you need implement onintercepttouchevent , return true when want intercept touch event.

touch events dispatched viewgroup's onintercepttouchevent. if returns false, touch events gets passed ontouchevent method of each child view of viewgroup in reverse drawing order. if no child returns true method, viewgroup gets event in ontouchevent.

http://developer.android.com/training/gestures/viewgroup.html

https://www.youtube.com/watch?v=ezaoju-nuyi


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -