android - 按住屏幕其他地方时,按钮无法响应点击事件?
PHP中文网
PHP中文网 2017-04-17 15:48:13
0
1
666

我按住屏幕的其他地方时,然后去点击某个按钮,但是无法相应点击事件,不知道应该怎么解决这个问题,求解决方案!

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
阿神

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template