private int mLastX;
private int mLastY;
public View.OnTouchListener onTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent ev) {
Log.e("InvParent", "--------v.getParent().getParent().getParent().getParent()--------->" + view.getParent().getParent().getParent().getParent());
Log.e("InvParent", "--------v.getParent().getParent().getParent()--------->" + view.getParent().getParent().getParent());
Log.e("InvParent", "--------v.getParent().getParent()--------->" + view.getParent().getParent());
Log.e("InvParent", "--------v.getParent()--------->" + view.getParent());
int x = (int) ev.getX();
int y = (int) ev.getY();
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
view.getParent().requestDisallowInterceptTouchEvent(true);
break;
case MotionEvent.ACTION_MOVE:
int xDiff = Math.abs(x - mLastX);
int yDiff = Math.abs(y - mLastY);
if (xDiff < yDiff) {
view.getParent().requestDisallowInterceptTouchEvent(false);
} else {
view.getParent().requestDisallowInterceptTouchEvent(true);
}
break;
}
mLastX = x;
mLastY = y;
// return super(ev);
return false;
}
};