Android解决暴力点击

防止用户暴力点击

MIN_DELAY_TIME 为点击间隔最小时间,可自定义设置

public static boolean isFastClick() {
    boolean flag = false;
    long currentClickTime = System.currentTimeMillis();
    if ((currentClickTime - lastClickTime2) >= MIN_DELAY_TIME) {
        flag = true;
    }
    lastClickTime2 = currentClickTime;
    return flag;
}

接下来自己封装点击事件 将此判断放入点击事件即可

你可能感兴趣的:(暴力点击)