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,附解决方法 #36

Open
g19980115 opened this issue Jun 19, 2018 · 0 comments
Open

碰到一个奇怪的bug,附解决方法 #36

g19980115 opened this issue Jun 19, 2018 · 0 comments

Comments

@g19980115
Copy link

ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate

解决方法:
修改SuperRecycleView.onCreateViewHolder

if (viewType == TYPE_REFRESH_HEADER) {
     return new SimpleViewHolder(mRefreshHeader);
}

改为

if (viewType == TYPE_REFRESH_HEADER) {
     if (mRefreshHeader.getParent() != null) {
          mRefreshHeader = new ArrowRefreshHeader(getContext());
     }
     return new SimpleViewHolder(mRefreshHeader);
 }
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

1 participant