Why getEdgeFlags () always returns 0

I want to detect a tangent edge in the onTouchEvent function for my view, but getEdgeFlags () always returns 0 in my Nexus S 4.1.1, can anyone help me? thanks in advance.

@Override
public boolean onTouchEvent(MotionEvent event) {
    int edgeFlags = event.getEdgeFlags();
    //edgeFlags alway 0!
    switch (edgeFlags) {
    case MotionEvent.EDGE_LEFT:
        Log.i("tag", "EDGE_LEFT");
        break;
    case MotionEvent.EDGE_RIGHT:
        Log.i("tag", "EDGE_RIGHT");
        break;
    case MotionEvent.EDGE_TOP:
        Log.i("tag", "EDGE_TOP");
        break;
    case MotionEvent.EDGE_BOTTOM:
        Log.i("tag", "EDGE_BOTTOM");
        break;
    default:
        Log.i("tag", "" + edgeFlags);
        break;
    }
return super.onTouchEvent(event);
}
+2
source share
1 answer

I solved the problem of adding four buttons to launch four directions!

+1
source

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


All Articles