-
Notifications
You must be signed in to change notification settings - Fork 751
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
在 ConcatAdapter 中,itemViewType获取错误导致的崩溃 #317
Comments
官方的写法是类似这样的: when (holder) {
is AHolder -> (holder as AHolder).bind(.....)
is BHolder -> (holder as BHolder).bind(.....)
} 但是本库极度依赖 |
感谢反馈,目前不建议和 ConcatAdapter 一起使用,待近期适配 RV 1.2.0. |
看看是否和这个 issue 有关:https://issuetracker.google.com/issues/187339376 |
这个问题有新的进展么? |
这是来自QQ邮箱的假期自动回复邮件。
您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
|
同问,需要与ConcatAdapter一起使用,尝试各种方法无果。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在 ConcatAdapter 中,MultiTypeAdapter 通过
types.getType<Any>(viewHolder.itemViewType)
在某些情况下会导致崩溃,出现数组越界,因为获得的
viewHolder.itemViewType
并不稳定,不会与getItemViewType()
返回值一一对应。必须将 ConcatAdapter 配置中的
isolateViewTypes
参数设置为false
(其默认值为 true)。但是设置为false
之后,就会导致 ConcatAdapter 中所有 子Adapter
的ViewHolder
公用一个池子,不进行内部隔离。那这种就需要使用者,手动保持 每一个子Adapter
中getItemViewType()
返回值的唯一性。个人认为,
ConcatAdapter
默认会进行ViewHolder
的 itemType 隔离,那可能内部对ItemViewType
进行了某种操作The text was updated successfully, but these errors were encountered: