private long lastTouchTime = 0;
private static final long MIN_CLICK_INTERVAL = 1000; // 定义最小点击间隔,单位毫秒
@Override
public boolean onTouch(View v, MotionEvent event) {
long currentTime = System.currentTimeMillis();
if (currentTime - lastTouchTime >= MIN_CLICK_INTERVAL) {
lastTouchTime = currentTime;
// 处理触摸事件
return true;
}
return false; // 忽略事件
}
11-27
753
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交