我有一个库来处理ImageView的onTouchListener事件。
view.setOnTouchListener(new View.OnTouchListener() {
int lastAction;
float dX = 0;
float dY = 0;
int DELTA = 50;
private static final int MAX_CLICK_DURATION = 200;
private long pressStartTime;
@Override
public boolean onTouch(View view, final MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
pressStartTime = System.currentTimeMillis();
dX = view.getX() - event.getRawX();
dY = view.getY() - event.getRawY();
lastAction = MotionEvent.ACTION_DOWN;
break;
case MotionEvent.ACTION_UP:
if (lastAction == MotionEvent.ACTION_DOWN) {
break;
}
break;
case MotionEvent.ACTION_MOVE:
lastAction = MotionEvent.ACTION_MOVE;
break;
}
return false;
}
});
然后一旦将库安装到我的应用程序中,我还想为该ImageView设置我自己的onTouchEvent。
view.setOnTouchListener(new new View.OnTouchListener(){});
问题是只调用了库touchListener事件,而丢失/忽略了应用程序。如果我删除了库,则会调用app touch事件。我怎样才能调用库和app touchListeners?