DrawerLayout prevents call of MainActivity.onTouchEvent()

前端 未结 3 1242
梦谈多话
梦谈多话 2021-01-06 04:48

I have an app that overrides the onTouchEvent(MotionEvent ev) of the MainActivity to determine Two-Finger-Swipe and Pich-Open

3条回答
  •  感情败类
    2021-01-06 05:11

    A bit of a late update, but after having this issue for a couple of days, the solution that worked best for me was creating a CustomDrawerLayout. Then, casting the Context from the constructor as an Activity, called the Activity onTouchEvent from onInterceptTouchEvent.

    @Override public boolean onInterceptTouchEvent( MotionEvent ev )
    {
        getActivity().onTouchEvent( ev );
        return super.onInterceptTouchEvent( ev );
    }
    

    I find the code to be a lame hack... but works for me. Good luck!

提交回复
热议问题