Skip to content

对于有添加header、foot 的recyclerview,会报错 #96

Closed
@hp-xiaomage

Description

@hp-xiaomage

UncaughtException detected: java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10

Activity

changed the title [-]对于有添加header的recyclerview,会报错[/-] [+]对于有添加header、foot 的recyclerview,会报错[/+] on Mar 23, 2017
drakeet

drakeet commented on Mar 23, 2017

@drakeet
Owner

你使用的是第三方修改过的非原生 RecyclerView? 我不知道这些非原生 RecyclerView 做了什么 hack 事情或侵入性事情使得它不能正常被 MultiType 兼容。
你所提供的描述完全不能让人了解到这个问题产生的场景及原因。

请学会提问的技巧,包括提供相关代码、相关描述、更详细的错误栈、你自己为此做了哪些推测与解决办法等等。

目前由于信息严重不足,表示无能为力,暂且关闭当前 issue.

jngoogle

jngoogle commented on Sep 17, 2017

@jngoogle

@tz-xiaomage 表示用该库配合原生的 Recyclerview 并没有越界的报错。我在添加 foot 的时候是这样写的:

items.addAll(orderList);
items.add(items.size(), new Footer("footview"));

很有可能是你用的 Recyclerview 是另外的第三方封装的。

qqli007

qqli007 commented on Sep 17, 2017

@qqli007

和XRecyclerView搭配是有问题的,XRecyclerView的下拉刷新和加载更多的实现是通过添加HeadView和FootView实现的,但是没有在MultiType中处理这些HeadView和FootView,就会有上面的问题。

不想用swiperefreshlayout的话,需要修改XRecyclerView的代码,不过还没想好怎么修改。

dingbuoyi

dingbuoyi commented on May 16, 2019

@dingbuoyi

解决方案可以参考我的文章:https://www.jianshu.com/p/4c60a26cf02f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dingbuoyi@qqli007@drakeet@hp-xiaomage@jngoogle

        Issue actions

          对于有添加header、foot 的recyclerview,会报错 · Issue #96 · drakeet/MultiType