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

滑动冲突怎么处理捏? #5

Open
danbaibao opened this issue Oct 29, 2024 · 8 comments
Open

滑动冲突怎么处理捏? #5

danbaibao opened this issue Oct 29, 2024 · 8 comments

Comments

@danbaibao
Copy link

大佬,你好,我是新手,我这边使用了官方提供的处理viewpager2多个滑动冲突的代码,在布局文件上我定义了viewpager2Container把com.zhzc0x.banner.BannerView包裹住了,但是没有能正确的处理,
a5bac9eec4f488b090381bce812b3ef9
7994a08de4e613eed38d3286a4dfb000

@zhzc0x
Copy link
Owner

zhzc0x commented Nov 5, 2024

请问是要处理和哪个组件的滑动冲突?可以贴下完整的布局代码

@danbaibao
Copy link
Author

danbaibao commented Nov 5, 2024 via email

@danbaibao
Copy link
Author

请问是要处理和哪个组件的滑动冲突?可以贴下完整的布局代码

1.在MainActivity布局文件中创建了viewpager2和tabLayout,然后给viewpager2绑定IndexFragment;
2.在IndexFragment布局文件中创建了BannerView

问题:
发现BannerView的滑动事件和MainActivity的viewpaper2滑动事件有冲突,只有viewpaper2的滑动事件有效,BannerView的滑动事件被拦截了

f533cb4dc1a602b5283af0aa692bbb78
b8ad84643deb8d7e3c51ec64ddfa8ea8

@zhzc0x
Copy link
Owner

zhzc0x commented Nov 6, 2024

BannerView是继承FrameLayout的,,可以新建一个继承BannerView的类,加上处理滑动冲突的代码,直接用这个类放到ViewPage2里试下

@zhzc0x
Copy link
Owner

zhzc0x commented Nov 7, 2024

Relase1.1.1新增了NestedBannerView,示例也更新了,测试没有问题

@danbaibao
Copy link
Author

Relase1.1.1新增了NestedBannerView,示例也更新了,测试没有问题
好的,大佬
非常感谢

@zhzc0x
Copy link
Owner

zhzc0x commented Nov 8, 2024

没问题给点个star吧,感谢

@danbaibao
Copy link
Author

没问题给点个star吧,感谢

好的好的

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

2 participants