How to consume child view's touch event in parent view's touchlistener?

前端 未结 4 1029
慢半拍i
慢半拍i 2020-12-29 06:59

In my application I want to get the touch event of all child view\'s in my parent view\'s onTouchListener but I could not get this.

Example:

4条回答
  •  一个人的身影
    2020-12-29 07:43

    I have tried similar design with (only one onTouch Listener on a root FrameLayout) and it worked. I get all the points provided that onTouch return true instead of false. Otherwise, I just get the first point. I couldn't find out the reason for this "return" issue since I expect opposite behaviour.

    However, based on my experience, if you set any of child view clickable, then its parent's onTouch will not work. If you have another solution and if you share, that would be great.

提交回复
热议问题