标签:actionbarssherlock slidingmenu
当我们在使用开源框架SlidingMenu时,如果要是使用到ViewPager,就会出现滑动冲突。
解决方案:
}/** 解决ViewPager和侧滑冲突 */ public void changeSlidingMenuTOUCHMODE(int arg0) { switch (arg0) { case 0: if (getActivity() instanceof SlidingFragmentActivity) { SlidingFragmentActivity activity = (SlidingFragmentActivity) getActivity(); activity.getSlidingMenu().setTouchModeAbove( SlidingMenu.TOUCHMODE_FULLSCREEN); } break; default: if (getActivity() instanceof SlidingFragmentActivity) { SlidingFragmentActivity activity = (SlidingFragmentActivity) getActivity(); activity.getSlidingMenu().setTouchModeAbove( SlidingMenu.TOUCHMODE_MARGIN); } break; } }然后在viewpager的setOnPageChangeListener事件监听中的onPageSelected方法中调用changeSlidingMenuTOUCHMODE(page);
代码如下:
@Override public void onPageSelected(int page) { // TODO Auto-generated method stub changeSlidingMenuTOUCHMODE(page); }
解决侧滑中ViewPager和SlidingMenu的滑动冲突
标签:actionbarssherlock slidingmenu
原文地址:http://blog.csdn.net/kern_/article/details/45437375