According to the event response in Android, the event is passed from the activity to the window, then to the decorview, and then to our contentview, and then the event is distributed. First, it is judged from the high-level viewgroup whether to intercept it. If it is not intercepted, it is passed down and passed to After the bottom layer, if onTouchListener is set, the method in the listening interface is executed. Otherwise, onTouch is executed and true is returned, then the event is consumed and will not be processed in the upper layer. If false is returned, the upper layer still needs to continue. deal with. Understanding the upper-level event distribution process, now let’s talk about your problem. Press and hold the screen. An event will be generated at this time, but the event cannot be consumed where you press, so the event bit is consumed, affecting new events. distribution. So the button cannot be clicked. Because the event cannot be delivered to the button.
According to the event response in Android, the event is passed from the activity to the window, then to the decorview, and then to our contentview, and then the event is distributed. First, it is judged from the high-level viewgroup whether to intercept it. If it is not intercepted, it is passed down and passed to After the bottom layer, if onTouchListener is set, the method in the listening interface is executed. Otherwise, onTouch is executed and true is returned, then the event is consumed and will not be processed in the upper layer. If false is returned, the upper layer still needs to continue. deal with.
Understanding the upper-level event distribution process, now let’s talk about your problem. Press and hold the screen. An event will be generated at this time, but the event cannot be consumed where you press, so the event bit is consumed, affecting new events. distribution. So the button cannot be clicked. Because the event cannot be delivered to the button.