版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qingfeng812/article/details/51751145
private class BussinessDetailAdapter extends BaseAdapter{ private Context ct; private ArrayList<Business> mdata=new ArrayList<>(); private LayoutInflater inflater; public void BusinessDetailAdapter(Context ct,ArrayList<Business> data){ this.ct=ct; this.mdata=data; this.inflater= LayoutInflater.from(ct); } @Override public int getCount() { return mdata.size(); } @Override public Object getItem(int position) { return mdata.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder=null; if (convertView==null){ convertView= inflater.inflate(R.layout.item_business_detail,null); holder = new ViewHolder(); holder.tv_num= (TextView) convertView.findViewById(R.id.tv_crm_business_num); holder.tv_num= (TextView) convertView.findViewById(R.id.tv_crm_business_num); holder.tv_num= (TextView) convertView.findViewById(R.id.tv_crm_business_num); holder.tv_num= (TextView) convertView.findViewById(R.id.tv_crm_business_num); holder.tv_num= (TextView) convertView.findViewById(R.id.tv_crm_business_num); holder.tv_num= (TextView) convertView.findViewById(R.id.tv_crm_business_num); holder.tv_num= (TextView) convertView.findViewById(R.id.tv_crm_business_num); holder.tv_num= (TextView) convertView.findViewById(R.id.tv_crm_business_num); holder.tv_num= (Button) convertView.findViewById(R.id.bt_business_qiang); convertView.setTag(convertView); }else{ holder= (ViewHolder) convertView.getTag(); } holder.tv_num.setText(mdata.get(position).getNum()); holder.tv_name.setText(mdata.get(position).getName()); holder.tv_date.setText(mdata.get(position).getDate()); holder.tv_datetv.setText(""); holder.tv_leader.setText(mdata.get(position).getLeader()); holder.tv_note.setText(mdata.get(position).getNote()); holder.tv_phone.setText(mdata.get(position).getPhone()); holder.tv_source.setText(mdata.get(position).getSource()); if (mdata.get(position).getType()==0){ holder.bt_event.setVisibility(View.GONE); }else if (mdata.get(position).getType()==1){ holder.bt_event.setVisibility(View.VISIBLE); holder.bt_event.setText("抢"); }else if(mdata.get(position).getType()==2){ holder.bt_event.setVisibility(View.VISIBLE); holder.bt_event.setText("分配"); } holder.bt_event.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mdata.get(position).getType()==1){ }else if(mdata.get(position).getType()==2){ } } }); return convertView; } class ViewHolder{ TextView tv_num; TextView tv_name; TextView tv_leader; TextView tv_source; TextView tv_phone; TextView tv_note; TextView tv_datetv; TextView tv_date; Button bt_event; } }