这是最后成功的办法 ---关于防止用户过快频繁的点击按钮事件
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;} } }
}
然后在点击事件中下面写
if(SmButton.Utils.isNotFastClick()){ //您的代码 }