我在检测触摸事件时遇到问题。无需滚动即可正常工作。但是当我移除手指时滚动完成后无法接收运动向上事件。我正在使用以下代码。
linearMain.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
// Do Something
Log.d("Touch", "Touch down");
// Now Set your animation
slidingDrawerMos.startAnimation(slideOutAnimation);
slidingDrawerReviews.startAnimation(slideOutAnimation);
slidingDrawerMos.setVisibility(View.GONE);
slidingDrawerReviews.setVisibility(View.GONE);
break;
case MotionEvent.ACTION_MOVE:
// Do Something
Log.d("Touch", "Touch move");
break;
case MotionEvent.ACTION_UP:
// Do Something
Log.d("Touch", "Touch up");
slidingDrawerMos.setVisibility(View.VISIBLE);
slidingDrawerReviews.setVisibility(View.VISIBLE);
// Now Set your animation
slidingDrawerMos.startAnimation(slideInAnimation);
slidingDrawerReviews.startAnimation(slideInAnimation);
break;
case MotionEvent.ACTION_CANCEL:
Log.d("Touch", "Touch cancel");
break;
default:
break;
}
return true;
}
});