Search code examples
androidnavigation-drawerdrawerlayout

DrawerLayout: Disable clicks on content when drawer is open


I have a DrawerLayout which contains a ListView and a FrameLayout, which contains a TabHost. If I click in a empty area of my DrawerLayout, the click gets passed down to the FrameLayout, often changing the state of my tabs. The tabs are hidden from view, so I don't want this to happen.

Is there any method to intercept touch events when the DrawerLayout is open so this does not happen?


Solution

  • try this :

    getParent().requestDisallowInterceptTouchEvent(true);
    

    This disallows to pass the event to its parent layout. (Stops event propogation).