content: package com.cjj.loadmorervdemo;
  
  import android.content.Context;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ImageView;
  
  import java.util.List;
  
  public class DemoRvAdapter extends RecyclerView.Adapter<DemoRvAdapter.MyViewHolder> {
  
      private Context mContext;
      private List<Integer> mDataList;
  
      public DemoRvAdapter(Context context, List<Integer> mDatas) {
          mContext = context;
          mDataList = mDatas;
      }
  
      @Override
      public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          return new MyViewHolder(
                  LayoutInflater.from(mContext).inflate(R.layout.item_home, parent, false));
      }
  
      @Override
      public void onBindViewHolder(MyViewHolder holder, int position) {
          holder.mImageView.setImageResource(mDataList.get(position));
      }
  
      @Override
      public int getItemCount() {
          return mDataList.size();
      }
  
      class MyViewHolder extends RecyclerView.ViewHolder {
  
          ImageView mImageView;
  
          public MyViewHolder(View view) {
              super(view);
              mImageView = (ImageView) view.findViewById(R.id.iv_image);
          }
      }
  }