getEdgeFlags always returning 0?

匿名 (未验证) 提交于 2019-12-03 00:53:01

问题:

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

I extended DrawerLayout, and 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, edgeFlags is always 0.

Tested on G2 with 4.4.2, S3 with 4.3.1 and emulated S4 with 4.2.2. I am aware that only ACTION_DOWN touches get edge detection, but I don't get any detected, ever. Still, the drawer layout obviously manages to detect it since it opens the drawer on edge swipe just fine. I get the same (lack of) results with subclassing ViewPager too. Overriding onTouchEvent() method doesn't help either.

What am I doing wrong?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!