Baserecyclerviewadapterhelper: 添加headerview后 使用ExpandableItem 在 item未满一屏幕情况下 adapter.expandAll 方法无效 子项无法展开

Created on 18 Sep 2017  ·  3Comments  ·  Source: CymChad/BaseRecyclerViewAdapterHelper

添加headerview后 使用ExpandableItem 在 item未满一屏幕情况下 adapter.expandAll 方法无效 子项无法展开,去掉headerview后正常

在demo ExpandableUseActivity中添加headerview后:

adapter.setHeaderView(new ImageView(this));
mRecyclerView.setAdapter(adapter);
// important! setLayoutManager should be called after setAdapter
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
adapter.expandAll();

报错:
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1
at java.util.ArrayList.get(ArrayList.java:310)
at com.chad.library.adapter.base.BaseQuickAdapter.getItem(BaseQuickAdapter.java:526)
at com.chad.library.adapter.base.BaseQuickAdapter.getExpandableItem(BaseQuickAdapter.java:1701)
at com.chad.library.adapter.base.BaseQuickAdapter.expandAll(BaseQuickAdapter.java:1564)
at com.chad.library.adapter.base.BaseQuickAdapter.expandAll(BaseQuickAdapter.java:1605)
at com.chad.baserecyclerviewadapterhelper.ExpandableUseActivity.onCreate(ExpandableUseActivity.java:47)

Most helpful comment

compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'

All 3 comments

收到,我这边看看

compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'

可以了 最新版本没问题了 谢谢!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AnJiuZhe picture AnJiuZhe  ·  3Comments

axkza picture axkza  ·  6Comments

Felix1030 picture Felix1030  ·  3Comments

Freedomhxb picture Freedomhxb  ·  6Comments

Misakisogiou picture Misakisogiou  ·  5Comments