标签:end mil int over start str ble 设置 ati
自定义一个NoDoubleClickListener,继承自OnClickListener: public abstract class NoDoubleClickListener implements View.OnClickListener { public static final int MIN_CLICK_DELAY_TIME = 1000; private long lastClickTime = 0; @Override public void onClick(View v) { long currentTime = Calendar.getInstance().getTimeInMillis(); if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) { lastClickTime = currentTime; onNoDoubleClick(v); } } protected abstract void onNoDoubleClick(View v); } 在设置点击事件时用NoDoubleClickListener替换OnClickListener,并且实现方法onNoDoubleClick替换onClick即可: btnPay.setOnClickListener(new NoDoubleClickListener() { @Override protected void onNoDoubleClick(View v) { startPay(); } }); }
标签:end mil int over start str ble 设置 ati
原文地址:http://www.cnblogs.com/baiyi168/p/7813842.html