public void onClick(View v) { if (isclick) Log.i(TAG, "onclick"); } }); } float distance = 0; float start, end; boolean isclick = false; boolean isFirst = false; @Override public boolean onTouchEvent(MotionEvent event) { super.onTouchEvent(event); Log.i(TAG, "onTouchEvent: "); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: isclick = false;//点击状态清空 start = event.getX(); break; case MotionEvent.ACTION_MOVE: end = event.getX(); distance = end - start; if (isFirst==false&&Math.abs(distance) > 10) {//如果滑动距离大于指定数,并判断是否第一次(解决滑出指定距离又滑入当作是点击事件bug) isFirst = true; } if(isFirst){//如果首次确认是滑动状态责之后滑动都进入此块代码 Log.i(TAG, "move"); } break; case MotionEvent.ACTION_UP: if (isFirst) {//是滑动状态 isclick = false; } else {//点击状态 isclick = true; } isFirst = false;//滑动状态清空 break; } return true; }