-
Notifications
You must be signed in to change notification settings - Fork 66
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
菜单展开的时候,执行notifyDatasetChange,状态会错位 #39
Comments
我通过记录位置的方式修正:notifyDataSetChanged()时,原始打开位置的左滑菜单默认隐藏,我记录状态,onbindView时再打开,有一个闪现的过程,体验十分不好 原因是:onBindView时直接调用openmenu无效,必须等到onMesuer,onlayout结束之后才行,我现在onBindView时是这样做的 大佬救我 |
错位问题确实是RecyclerView复用导致的,开启和关闭需要自己记录。 不过我倒是有个办法可以暂时解决你的问题,在onCreateViewHolder的时候主动测量一次就好了,虽然很丑但是能解决问题,例如: override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val swipeLayout = LayoutInflater.from(parent.context).inflate(R.layout.item_xxx, parent, false)
swipeLayout.measure(0, 0)
return object: ViewHolder(swipeLayout){}
} |
感谢大佬 |
比如从现在RecycleView中,第5条rightMenu处于open状态,执行notifyDatasetChange,这个时候,第5条的状态会变为初始关闭状态,而第1条或2条的rightMenu处于open状态,能修复一下吗?
原因可能是RecycleView复用导致的
The text was updated successfully, but these errors were encountered: