android - giving onTouch priority over onClick

五迷三道 提交于 2019-12-01 09:29:29

If you return true from your onFling(…) it should consume the event and stop propagation.

You can find here solution for delegating a touch from parent to child view, if you need more info.

mDrawerLayout.post(() -> {
        Rect delegateArea = new Rect();

        mCalendarView.getHitRect(delegateArea);
        delegateArea.right += 100;
        delegateArea.bottom += 100;

        TouchDelegate touchDelegate = new TouchDelegate(delegateArea, mCalendarView);

        if (View.class.isInstance(mCalendarView.getParent())) {
            ((View) mCalendarView.getParent()).setTouchDelegate(touchDelegate);
        }
    });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!