我正在尝试检测网页浏览中的滑动手势。
我尝试使用以下功能:
public boolean onTouchEvent(MotionEvent event) {
int action = MotionEventCompat.getActionMasked(event);
String DEBUG_TAG = "test";
switch (action) {
case (MotionEvent.ACTION_DOWN):
Log.d(DEBUG_TAG, "Action was DOWN");
return true;
case (MotionEvent.ACTION_MOVE):
Log.d(DEBUG_TAG, "Action was MOVE");
return true;
case (MotionEvent.ACTION_UP):
Log.d(DEBUG_TAG, "Action was UP");
return true;
case (MotionEvent.ACTION_CANCEL):
Log.d(DEBUG_TAG, "Action was CANCEL");
return true;
case (MotionEvent.ACTION_OUTSIDE):
Log.d(DEBUG_TAG, "Movement occurred outside bounds " +
"of current screen element");
return true;
default:
return super.onTouchEvent(event);
}
}
当没有webview时,它会起作用并找回正确的答案。 但是,当我添加上面的内容时,它在webview上不起作用。由于webview必须全屏,我想我不能使用上面的功能。 有没有其他方法或我有什么问题?