这是我的代码,我想检测我的手指何时落下屏幕,所以当我触摸屏幕时,我检测到但当我ACTION_DOWN
用手指顺着屏幕向下时,ACTION_MOVE
无法识别,ACTION_UP
你知道为什么吗?
float x=0;
protected void onCreate(Bundle savedInstanceState) {
do things
ImageView image2 = (ImageView) findViewById(R.id.imageView3);
image2.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
if (arg1.getAction()==MotionEvent.ACTION_DOWN) {
x=arg1.getX();
}
else {
if (arg1.getAction()==MotionEvent.ACTION_MOVE){
if (arg1.getX()>x) {
do things
}
}
else {
if (arg1.getAction()==MotionEvent.ACTION_UP){
do things
}
}
}
}