android实现双击事件的监听

class onDoubleClick implements View.OnTouchListener{


@Override

public boolean onTouch(View v, MotionEvent event) {

if(MotionEvent.ACTION_DOWN == event.getAction()){

count++;

if(count == 1){

firClick = System.currentTimeMillis();

} else if (count == 2){

secClick = System.currentTimeMillis();

if(secClick - firClick < 1000){

//双击事件

}

count = 0;

firClick = 0;

secClick = 0;

}

}

return true;

}


你可能感兴趣的:(android,双击)