看来代码真的是一段时间不敲手就生,刚才在写项目的时候,发现之前闭着眼都能写出来的recyclerview适配都忘记怎么写了,在这里巩固一下,省的又忘了,哈哈哈
首先就是创建类继承 RecyclerView.Adapter<MyViewHolder> 这个MyViewHolder就是我们的item布局
recyclerviewAdapter类:
package com.jiuhao.jhjk.adapter.welcome;
import android.annotation.SuppressLint;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.jiuhao.jhjk.R;
import com.jiuhao.jhjk.bean.DepartmentBean;
import java.util.ArrayList;
import java.util.List;
/**
* Created by lixiaona on 2019/8/23.
*/
public class AdministrativeRecycler extends RecyclerView.Adapter<AdministrativeRecycler.AdministrativeViewHolder> {
private Context context;
private List<DepartmentBean> list &#