OnTouchEvent not working on child views

前端 未结 7 1910
梦如初夏
梦如初夏 2020-11-29 21:45

I have a Linear Layout that has a Button and a TextView on it. I have written a OnTouchEvent for the activity. The code works fine if I touch on the screen, but if I touch t

7条回答
  •  死守一世寂寞
    2020-11-29 22:31

    Let me add one more comment to this excellent post by @Devunwired.

    If you've also set an onTouchListener on your View, then its onTouch() method will be called AFTER the dispatch methods, but BEFORE any onTouchEvent() method, i.e. in between no.3 and no.4 on @Devunwired's answer.

提交回复
热议问题