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侧滑菜单和轮播图之滑动冲突问题-创新互联
网页网址:https://www.cdcxhl.com/article38/dpihsp.html

成都网站建设公司_创新互联,为您提供面包屑导航品牌网站设计动态网站营销型网站建设App开发品牌网站建设

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都定制网站网页设计