Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何禁止swiper的手势滑动操作,只让其轮播? #109

Closed
CCY0122 opened this issue Jul 25, 2019 · 4 comments
Closed

如何禁止swiper的手势滑动操作,只让其轮播? #109

CCY0122 opened this issue Jul 25, 2019 · 4 comments

Comments

@CCY0122
Copy link

CCY0122 commented Jul 25, 2019

作者你好。请问如何让Swiper不接受触摸滑动,而只能轮播?就行安卓原生上ViewFlipper那样

@CCY0122
Copy link
Author

CCY0122 commented Aug 1, 2019

我想补充下我的问题:我想禁用掉Swiper的滑动事件,但是点击事件还是想要保留,所以直接给Swiper套一层 IgnorePointer是不满足需求的。
这种需求还是很常见的,如一个垂直列表中含一个垂直滚动的广告轮播栏,当用户手指落点在广告栏并上下滑动时,肯定希望仍然滑动的是列表而不是广告栏,一般期望广告栏只接受点击事件的。

@CCY0122
Copy link
Author

CCY0122 commented Aug 2, 2019

解决了。给Swiper使用NeverScrollableScrollPhysics()这个physics即可

@bianxiang
Copy link

请问自动轮播的时候如何使点击每一个item可响应?必须停下来才能点击 @CCY0122

@frankfancode
Copy link

请问自动轮播的时候如何使点击每一个item可响应?必须停下来才能点击 @CCY0122

有个较为麻烦的方法
计算点击时滑动的比例和点击位置在显示区域的比例,然后根据两个比例计算 点击位置应该落于哪一项。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants