java.lang.IllegalStateException: ViewHolder views must not be attached when created.
这说明onCreateViewHolder 方法写错了
这句话的意思是,viewHolder不予许在创建的时候添加到parent里,所以如果在onCreateViewHolder方法里使用:
View view = inflater.inflate(R.layout.item_view, parent, true);
或者
View view = inflater.inflate(R.layout.item_view, parent);
就会报错:
ViewHolder views must not be attached when created. Ensure that you are not passing ‘true’ to the attachToRoot parameter of LayoutInflate
只要改成:
// View view = inflater.inflate(R.layout.item_view, null); 或者
// View view = inflater.inflate(R.layout.item_view, parent, false);
View rootView = LayoutInflater.from(CheckInActivity.this).inflate( R.layout.layout_check_in_week, parent,false);