方法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()){
//你的代码
}
}
});
如果点击listview条目跳转的是一个页面,可以设置下一个页面的启动模式launchModel = singleTop
网友评论