Android侧滑菜单和轮播图之滑动冲突问题-创新互联

接手一个项目,有一个问题需要修改:轮播图不能手动滑动,手动滑动轮播图只会触发侧滑菜单。

成都创新互联公司是一家企业级云计算解决方案提供商,超15年IDC数据中心运营经验。主营GPU显卡服务器,站群服务器,雅安机房托管,海外高防服务器,大带宽服务器,动态拨号VPS,海外云手机,海外云服务器,海外服务器租用托管等。

猜测:viewpager控件(轮播图)的触摸事件被SlidingMenu控件(侧滑菜单,非第三方项目,乃是上个开发人员自定义的)拦截了。

基于这个猜测,我自定义一个ViewPager,重写dispatchTouchEvent、onInterceptTouchEvent和onTouchEvent,分别在这三个方法中打印log;

重写SlidingMenu的dispatchTouchEvent、onInterceptTouchEvent和onTouchEvent,同样打印log。

重新编译运行,手滑轮播图,log如下:

06-08 09:52:08.394 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:0
06-08 09:52:08.395 19424-19424/com.parkingmore E/SlidingMenu: onInterceptTouchEvent ev:0
06-08 09:52:08.395 19424-19424/com.parkingmore E/RollViewPager: dispatchTouchEvent ev:0
06-08 09:52:08.395 19424-19424/com.parkingmore E/RollViewPager: onInterceptTouchEvent ev:0
06-08 09:52:08.441 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.441 19424-19424/com.parkingmore E/SlidingMenu: onInterceptTouchEvent ev:2
06-08 09:52:08.442 19424-19424/com.parkingmore E/SlidingMenu: ACTION_MOVE dx:15.473999
06-08 09:52:08.442 19424-19424/com.parkingmore E/RollViewPager: ACTION_MOVE getCurrentItem():1
06-08 09:52:08.442 19424-19424/com.parkingmore E/RollViewPager: dispatchTouchEvent ev:2
06-08 09:52:08.442 19424-19424/com.parkingmore E/RollViewPager: onInterceptTouchEvent ev:2
06-08 09:52:08.459 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.459 19424-19424/com.parkingmore E/SlidingMenu: onInterceptTouchEvent ev:2
06-08 09:52:08.459 19424-19424/com.parkingmore E/RollViewPager: dispatchTouchEvent ev:3
06-08 09:52:08.459 19424-19424/com.parkingmore E/RollViewPager: onInterceptTouchEvent ev:3
06-08 09:52:08.477 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.477 19424-19424/com.parkingmore E/SlidingMenu: onTouchEvent ev:2
06-08 09:52:08.495 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.495 19424-19424/com.parkingmore E/SlidingMenu: onTouchEvent ev:2
06-08 09:52:08.515 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.515 19424-19424/com.parkingmore E/SlidingMenu: onTouchEvent ev:2
06-08 09:52:08.533 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.533 19424-19424/com.parkingmore E/SlidingMenu: onTouchEvent ev:2
06-08 09:52:08.551 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.551 19424-19424/com.parkingmore E/SlidingMenu: onTouchEvent ev:2
06-08 09:52:08.574 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.574 19424-19424/com.parkingmore E/SlidingMenu: onTouchEvent ev:2
06-08 09:52:08.594 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.595 19424-19424/com.parkingmore E/SlidingMenu: onTouchEvent ev:2
06-08 09:52:08.611 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.612 19424-19424/com.parkingmore E/SlidingMenu: onTouchEvent ev:2
06-08 09:52:08.622 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:2
06-08 09:52:08.622 19424-19424/com.parkingmore E/SlidingMenu: onTouchEvent ev:2
06-08 09:52:08.623 19424-19424/com.parkingmore E/SlidingMenu: dispatchTouchEvent ev:1

新闻名称:Android侧滑菜单和轮播图之滑动冲突问题-创新互联
标题URL:http://pwwzsj.com/article/dpihsp.html