Gestures not working when using DrawerLayout in Android app

后端 未结 1 708
时光取名叫无心
时光取名叫无心 2021-02-14 07:02

I have an Android app with a single Activity. This activity uses this layout:



        
1条回答
  •  后悔当初
    2021-02-14 07:36

    you have to set a TouchListener for your drawer layout. eg/

    gestureDetector = new GestureDetector(this, new CustomGestureListener());
    
        mDrawerLayout.setOnTouchListener(new View.OnTouchListener() {
            public boolean onTouch(View v, MotionEvent event) {
                if (gestureDetector.onTouchEvent(event)) {
                    return true;
                }
                return false;
            }
        });
    

    0 讨论(0)
提交回复
热议问题