content: package com.yl.sample.adapter;
  
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  import com.yl.sample.R;
  
  import java.util.List;
  
  import androidx.recyclerview.widget.RecyclerView;
  
  /**
   * Divider item decoration adapter.
   * <p>
   * Created by yangle on 2018/11/27.
   * Website：http://www.yangle.tech
   */
  public class DividerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
  
      private List<String> mDataList;
  
      public DividerAdapter(List<String> dataList) {
          this.mDataList = dataList;
      }
  
      @Override
      public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.adapter_divider, parent, false);
          return new RecyclerViewHolder(view);
      }
  
      @Override
      public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
          RecyclerViewHolder recyclerViewHolder = (RecyclerViewHolder) holder;
          recyclerViewHolder.tvItem.setText(mDataList.get(position));
      }
  
      @Override
      public int getItemCount() {
          return mDataList.size();
      }
  
      private class RecyclerViewHolder extends RecyclerView.ViewHolder {
  
          TextView tvItem;
  
          RecyclerViewHolder(View itemView) {
              super(itemView);
              tvItem = itemView.findViewById(R.id.tv_item);
          }
      }
  }
  