public class Utils { private static long lastClickTime; public static boolean isFastDoubleClick() { long time = System.currentTimeMillis(); long timeD = time - lastClickTime; if ( 0 < timeD && timeD < 3000) { return true; } lastClickTime = time; return false; } }
點擊時做出判斷 java
public void onClick(View v) { if (Utils.isFastDoubleClick()) { return; } }