long startTime;public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) startTime = System.nanoTime(); else if (event.getAction() == MotionEvent.ACTION_UP) { long elapseTime = System.nanoTime() - startTime; //do whatever u want with elapseTime now, its in nanoseconds }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)