Android double click event interception method
Next, we introduce two methods of double-click event interception
1. Intercept through the event distribution mechanism of Android (dispatchtouchevent)
Don't say much, just go to the code:
The usage is to directly add these two functions to the class where you need to intercept double-click events. The system will automatically call dispatchtouchevent to intercept events and shield double-click events. You can achieve the desired effect by adjusting the above time
The disadvantage is that the whole activity will mask the double-click event, which may affect the normal use of other components
2. Use the double-click function through a tool class
The way to use this function is to put it into a tool class. When you need to intercept double-click events, you can directly call this function to judge whether it is very convenient
The above Android double click event interception method is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.