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

Banner放在MotionLayout中做动画的时候调用notifyItemChanged不响应onBindViewHolder事件 #1230

Open
SwordSware opened this issue Jun 18, 2024 · 0 comments

Comments

@SwordSware
Copy link

SwordSware commented Jun 18, 2024

Banner放在MotionLayout中做动画,MotionLayout对应的layoutDescription:motion scene文件操作包裹Banner的Constraint开始结束设置关键属性visibility,最容易复现,基本是百分之百复现
复现之后,滑动一下Banner(也就是滑动一下RecyclerView)之后,onBindViewHolder方法才会被调用
如果Banner用RecyclerView代替,操作后再调用notifyItemChanged其onBindViewHolder可以被正常调用
[为此我做了一个demo来对比两者的不同表现(其中的item操作事件放在了onBindViewHolder方法中,是因为在onCreateViewHolder中获取postion也有问题,有时候会返回-1,而且正常情况也会返回错误,比如holder.getBindingAdapterPosition(),故放在onBindViewHolder)
IMG_20240618_102609

MotionLayoutBannerTestApplication.zip

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

1 participant