-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
加了 header 奔溃可能性很大 IndexOutOfBoundsException #46
Comments
你用的是那种adapter? |
是最新的版本吗? |
嗯。最新版。线性布局 header。 |
是多布局的吗? |
还有就是你最好把crash的所有日志贴出来看看 |
单一布局的 private void setupRecyclerView(RecyclerView recyclerView) {
Context context = recyclerView.getContext();
recyclerView.hasFixedSize();
recyclerView.setLayoutManager(new LinearLayoutManager(context));
adapter =
new BaseQuickAdapter<CreditClientInfo>(context, R.layout.client_card_progress_item, null) {
@Override protected void convert(BaseViewHolder helper, CreditClientInfo info) {
helper.setText(R.id.tv_in_date, info.ACCEPT_DATE);
helper.setText(R.id.tv_receive_date, info.RECEIVE_DATE_TIME);
helper.setText(R.id.tv_client_name, info.CLIENT_NAME);
helper.setText(R.id.tv_card_status, info.APPLICATION_STATUS);
}
};
//item 进入动画
adapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_BOTTOM);
recyclerView.setAdapter(adapter);
//加载更多监听
adapter.setOnLoadMoreListener(this);
adapter.openLoadMore(PAGE_SIZE, true);
//item 点击监听
adapter.setOnRecyclerViewItemClickListener(this);
adapter.setOnRecyclerViewItemChildClickListener(this);
//添加头部
headerView.setVisibility(View.VISIBLE);
adapter.addHeaderView(headerView);
//调用重新layout
recyclerView.setAdapter(adapter);
} |
把完整的crash贴出来。 |
谢谢。回复真快。 java.lang.IndexOutOfBoundsException
Inconsistency detected. Invalid item position 21(offset:21).state:22
android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4659)
android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4617)
android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1994)
android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1390)
android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1353)
android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1180)
android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1031)
android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4061)
android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
android.view.Choreographer.doCallbacks(Choreographer.java:670)
android.view.Choreographer.doFrame(Choreographer.java:603)
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
android.os.Handler.handleCallback(Handler.java:739)
android.os.Handler.dispatchMessage(Handler.java:95)
android.os.Looper.loop(Looper.java:148)
android.app.ActivityThread.main(ActivityThread.java:5466)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132) |
这是RecyclerView的bug 具体可查看 #16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 21(offset:21).state:22
The text was updated successfully, but these errors were encountered: