content: package com.jwenfeng.pulltorefresh.adapter;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.TextView;
  
  import com.jwenfeng.pulltorefresh.R;
  
  import java.util.List;
  
  /**
   * 当前类注释:
   * 作者：jinwenfeng on 2016/12/10 13:07
   * 邮箱：823546371@qq.com
   * QQ： 823546371
   * 公司：南京穆尊信息科技有限公司
   * © 2016 jinwenfeng
   * © 版权所有，未经允许不得传播
   */
  public class ListAdapter extends BaseAdapter {
  
      private List<String> list;
      private Context context;
  
      public ListAdapter(Context context, List<String> list) {
          this.list = list;
          this.context = context;
      }
  
      @Override
      public int getCount() {
          return list.size();
      }
  
      @Override
      public Object getItem(int i) {
          return list.get(i);
      }
  
      @Override
      public long getItemId(int i) {
          return i;
      }
  
      @Override
      public View getView(int i, View view, ViewGroup viewGroup) {
          ViewHolder viewHolder ;
          if (view == null) {
              view = LayoutInflater.from(context).inflate(R.layout.layout_item, null);
              viewHolder = new ViewHolder();
              viewHolder.tv = (TextView) view.findViewById(R.id.item_tv);
              view.setTag(viewHolder);
          } else {
              viewHolder = (ViewHolder) view.getTag();
          }
          viewHolder.tv.setText(list.get(i));
          return view;
      }
  
      class ViewHolder {
          private TextView tv;
      }
  
  }
  