這是最後成功的辦法 ---關於防止用戶過快頻繁的點擊按鈕事件spa
public class SmButton {
public static class Utils { public static final int DELAY = 2000; public static long lastClickTime = 0; public static boolean isNotFastClick(){ long currentTime = System.currentTimeMillis(); if (currentTime - lastClickTime > DELAY) { lastClickTime = currentTime; return true; }else{return false;} } }
}事件
而後在點擊事件中下面寫ast
if(SmButton.Utils.isNotFastClick()){
//您的代碼}