Does getEdgeFlags always return 0?

Why can't I ever get to getEdgeFlags()detect boundary touches?

I expanded DrawerLayoutand then did:

@Override
public boolean onInterceptTouchEvent(MotionEvent ev)
{
    int edgeFlags = ev.getEdgeFlags();
    Log.d(TAG,String.valueOf(edgeFlags));

    if ((MotionEvent.EDGE_LEFT&edgeFlags)!=0 || (MotionEvent.EDGE_RIGHT&edgeFlags)!=0)
        Log.d(TAG,"BEZEL intercept.");
    else
        Log.d(TAG,"Regular intercept.");
    return super.onInterceptTouchEvent(ev);
}

I never get any edge detected, edgeFlagsalways 0.

Tested on G2 with 4.4.2, S3 with 4.3.1 and emulated S4 with 4.2.2. I know that it only ACTION_DOWNaffects edge detection, but I don't get any detected. Nevertheless, the location of the box is clearly able to be detected, since it perfectly opens the box at the edge of the wires. I get the same (flaw) results with a subclass ViewPagertoo. Overriding a method onTouchEvent()does not help either.

What am I doing wrong?

+4
source share

Source: https://habr.com/ru/post/1529957/


All Articles