Skip to content
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

bug in android support 27.1.0 #43

Closed
kidd3166 opened this issue Mar 9, 2018 · 2 comments
Closed

bug in android support 27.1.0 #43

kidd3166 opened this issue Mar 9, 2018 · 2 comments

Comments

@kidd3166
Copy link

kidd3166 commented Mar 9, 2018

java.lang.IllegalStateException: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6687)
at com.oushangfeng.pinnedsectionitemdecoration.PinnedHeaderItemDecoration.createPinnedHeader(PinnedHeaderItemDecoration.java:298)
at com.oushangfeng.pinnedsectionitemdecoration.PinnedHeaderItemDecoration.onDraw(PinnedHeaderItemDecoration.java:147)

@oubowu
Copy link
Owner

oubowu commented Mar 9, 2018

定位到是手动调用适配器的bindViewHolder出现的问题,请问你在bindViewHolder的实现那里,inflate布局的时候,是不是attachToParent参数置为true了?
// 手动调用创建标签 final RecyclerView.ViewHolder holder = mAdapter.createViewHolder(parent, type); mAdapter.bindViewHolder(holder, mPinnedHeaderPosition);

@oubowu oubowu closed this as completed Nov 5, 2018
@xie2000
Copy link

xie2000 commented Jan 9, 2019

我也碰到一样的问题,inflate时attachToParent=false,也一样出现这个问题,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants