We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
比如从现在RecycleView中,第5条rightMenu处于open状态,执行notifyDatasetChange,这个时候,第5条的状态会变为初始关闭状态,而第1条或2条的rightMenu处于open状态,能修复一下吗?
原因可能是RecycleView复用导致的
The text was updated successfully, but these errors were encountered:
我通过记录位置的方式修正:notifyDataSetChanged()时,原始打开位置的左滑菜单默认隐藏,我记录状态,onbindView时再打开,有一个闪现的过程,体验十分不好
原因是:onBindView时直接调用openmenu无效,必须等到onMesuer,onlayout结束之后才行,我现在onBindView时是这样做的 //binding.swipeLayout.openRightMenu(false) 此时menu为空,不会执行 binding.swipeLayout.post { //必须等到绘制完成才行,才会生效,但是这样就会等待和闪现 binding.swipeLayout.openRightMenu(false) }
大佬救我
Sorry, something went wrong.
错位问题确实是RecyclerView复用导致的,开启和关闭需要自己记录。 onBindViewHolder没法开启菜单确实是设计缺陷,这控件就是奇怪的代码堆起来的,我自己都改不动了……
不过我倒是有个办法可以暂时解决你的问题,在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){} }
感谢大佬
No branches or pull requests
比如从现在RecycleView中,第5条rightMenu处于open状态,执行notifyDatasetChange,这个时候,第5条的状态会变为初始关闭状态,而第1条或2条的rightMenu处于open状态,能修复一下吗?
原因可能是RecycleView复用导致的
The text was updated successfully, but these errors were encountered: