在RelativeLayout中,我想移动一个视图。但是在onTouch()中只有ACTION_DOWN被击中。我无法获得ACTION_MOVE或ACTION_UP。以下是代码段。
private final class MyTouchListener implements OnTouchListener {
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
log("onTouch motion event ACTION_DOWN ");
break;
case MotionEvent.ACTION_MOVE:
log("onTouch motion event ACTION_MOVE ");
break;
case MotionEvent.ACTION_UP:
log("onTouch motion event ACTION_UP ");
break;
}
return true;
}
}
需要帮助......
答案 0 :(得分:0)
在return false;
方法中写return true;
而不是onTouch();
;
<强>更新强>
switch(event.getAction()){
}