Skip to content

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

@g19980115

Description

@g19980115

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);
 }

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

    Issue actions