Closed lutao2599 closed 3 years ago
子布局数据出现紊乱一般是因为 1、getChildViewType返回的type没有保证唯一,每种item需要保证一个唯一的type。 2、onBindChildViewHolder中没有判断type来绑定数据。
你查一下你的代码,看是那里写错了。
后台返回的item中的viewType重复可以吗?
------------------ 原始邮件 ------------------ 发件人: "donkingliang/GroupedRecyclerViewAdapter" <notifications@github.com>; 发送时间: 2020年12月1日(星期二) 下午4:38 收件人: "donkingliang/GroupedRecyclerViewAdapter"<GroupedRecyclerViewAdapter@noreply.github.com>; 抄送: "追梦赤子"<1336440850@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [donkingliang/GroupedRecyclerViewAdapter] 只有组头时,子布局实现多布局时上下滑动复用数据出现紊乱 (#62)
子布局数据出现紊乱一般是因为 1、getChildViewType返回的type没有保证唯一,每种item需要保证一个唯一的type。 2、onBindChildViewHolder中没有判断type来绑定数据。
你查一下你的代码,看是那里写错了。
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
不可以,viewType是getChildViewType返回,用于识别item布局类型的,必须是唯一的。而且头、尾、子项的viewType也不能重复。
不过我做了处理,返回的是viewType相同的我返回了同一个类型,这样也不行吗?
------------------ 原始邮件 ------------------ 发件人: "donkingliang/GroupedRecyclerViewAdapter" <notifications@github.com>; 发送时间: 2020年12月1日(星期二) 下午5:04 收件人: "donkingliang/GroupedRecyclerViewAdapter"<GroupedRecyclerViewAdapter@noreply.github.com>; 抄送: "追梦赤子"<1336440850@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [donkingliang/GroupedRecyclerViewAdapter] 只有组头时,子布局实现多布局时上下滑动复用数据出现紊乱 (#62)
不可以,viewType是getChildViewType返回,用于识别item布局类型的,必须是唯一的。而且头、尾、子项的viewType也不能重复。
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
只要保证一种type对应一种布局和数据就可以。
请问大神该怎么解决?