Android, disable the swiping to interact with SlidingPaneLayout

后端 未结 5 2106
無奈伤痛
無奈伤痛 2020-12-28 18:57

I need to disable swiping to open/close SlidingPaneLayout because my main view is a map. I\'ll open/close it using a button.

5条回答
  •  别那么骄傲
    2020-12-28 19:38

    If you set the touchlistener and return true, it will consume the touch event and the widget will not handle it further.

    slidingPaneLayout.setOnTouchListener(new View.OnTouchListener() { 
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            return true;
        }
    });
    

提交回复
热议问题