androidgoogle-mapsgoogle-maps-android-api-2slidingmenujfeinstein

Android, jfeinstein sliding activity with a Google Map in it sliding when user touches map


In my android app I have a jfeinstein sliding menu , I enabled the sliding gesture to show and hide it.

In one of my activities I have a google map, but when I touch the map to navigate into it, if i slide my finger from left to right, the menu appears and the map doesn't move.

Is there a way to prevent the menu from sliding in and 'pass' the touch event to the map in order to let the user navigate it?


Solution

  • There are two ways to resolve your issue:

    1. The easy way - sliding menu way, is to use the methods within the library and disable the sliding menu on certain activities/fragments. This is achieved by using the setTouchModeAbove

       // Allows the SlidingMenu to be opened with a swipe gesture on the screen's margin
       mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
      
       // Denies the SlidingMenu to be opened with a swipe gesture
       mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
      
       // Allows the SlidingMenu to be opened with a swipe gesture anywhere on the screen
       mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
      
    2. The most general solution would be to use onTouchIntercept method to decide is a touchevent should be passed through another view or it should be consumed by that viewgroup. The internet has enough examples addressing this.