The first thing to understand is the event distribution mechanism.
With regard to the event distribution mechanism, ViewGroup's event distribution has 3 key methods Dispathertouchevent,onintercepttouchevent,ontouchevent.
Distribute, intercept, execute.
The emergence of sliding collisions, mainly because of the existence of multiple layers of nested sliding viewgroup, then if really to this scene, how should the response? Which layer of sliding events should I respond to?
Multi-layer nested sliding viewgroup, three cases (two layers nested inside and outside the sliding direction of the same, two layers nested inside and outside the sliding direction is inconsistent, inside and outside nested more than 3 layers with 3 layers), it is supposed to say, if do not do any processing, the program should default response to all the sliding events, but in fact, This default approach is often not the result we want.
So, how to solve the sliding conflict?
Method 1)oninterceptortouchevent external interception , the person who knows the message distribution mechanism should be familiar with this method, which is used to intercept the touch events sent from outside to inside, if the return value is true, Will not be sent down the message. Ensure that only the outer layer responds to sliding events, thereby resolving the conflict.
Method 2)dispathtouchevent internal interception ,
The actual case, which was later filled.
Android swipe conflict and how to resolve