方法1
public class Utils {
public static final int DELAY = 1000;
private static long lastClickTime = 0;
public static boolean isNotFastClick(){
long currentTime = System.currentTimeMillis();
if (currentTime - lastClickTime > DELAY) {
lastClickTime = currentTime;
return true;
}else{
return false;
}
}
}
用法:
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(Utils.isNotFastClick()){
//你的代碼
}
}
});
如果點(diǎn)擊listview條目跳轉(zhuǎn)的是一個(gè)頁(yè)面呈野,可以設(shè)置下一個(gè)頁(yè)面的啟動(dòng)模式launchModel = singleTop