Multiple Views OnTouch Events

后端 未结 3 1366
迷失自我
迷失自我 2021-01-02 05:56

We are developing an application where we need to capture MotionEvents from multiple views simultaneously. When we try to do so, Android only dispatches events to the first

3条回答
  •  心在旅途
    2021-01-02 06:32

    While this should work automatically with Android SDK 11+, it wasn't working for my app. I was trying to capture touches in a main view, plus some views that were subviews of the main view; in that case, touches were only captured by the view "level" that received the first touch. I reorganized my view structure so that all the views were siblings and now they are capturing events as expected.

提交回复
热议问题