Swipebacklayout slide to the right to close the current activity. slidingmenu slide to the right to open the menu part. In the same activity, when slidingmenu is in the open state, sliding to the right will give priority to swipebacklayout. As a result, most of the events on the screen are menus, A small part is that the current activity is directly closed when the activity content is used. Obviously, this is not what the user is willing to see (the correct operation scenario is: When slidingmenu is enabled, slide right first, the corresponding slidingmenu is closed slowly, and then the current activity is closed in response to swipebacklayout. If slidingmenu is closed, swipebacklayout is directly returned ).
Considering that both slidingmenu and swipebacklayout have their own statuses, and to maximize coupling, you can perform the following processing (re-write dispatchtouchevent directly in the current activity, and set the available status of swipebacklayout Based on slidingmenu status ):
1 @Override 2 public boolean dispatchTouchEvent(MotionEvent ev) { 3 if (menu.isMenuShowing()) { 4 if (mSwipeBackLayout.getEnableGesture()) { 5 mSwipeBackLayout.setEnableGesture(false); 6 } 7 } else { 8 if (!mSwipeBackLayout.getEnableGesture()) { 9 mSwipeBackLayout.setEnableGesture(true);10 }11 }12 return super.dispatchTouchEvent(ev);13 }
Resolve the conflict between slidingmenu and swipebacklayout right slide events