关于文艺式的使用中如果对某个item进行特殊处理的话,比如文字颜色改变突出显示,其他的item也会发生改变,下面是代码
MyViewHolder viewHolder;
if(convertView==null){
viewHolder=new MyViewHolder();
convertView=mInflater.inflate(R.layout.item_scoreinfo,null);
viewHolder.kc= (TextView) convertView.findViewById(R.id.scoreInfo_kc);
viewHolder.xn= (TextView) convertView.findViewById(R.id.scoreInfo_xn_value);
viewHolder.xq= (TextView) convertView.findViewById(R.id.scoreInfo_xq_value);
viewHolder.kscs= (TextView) convertView.findViewById(R.id.scoreinfo_kscs_value);
viewHolder.bfzkscj= (TextView) convertView.findViewById(R.id.scoreInfo_bfzkscj_value);
viewHolder.djzkscj= (TextView) convertView.findViewById(R.id.scoreInfo_djzkscj_value);
viewHolder.sftg= (TextView) convertView.findViewById(R.id.scoreInfo_sftg_value);
viewHolder.xf= (TextView) convertView.findViewById(R.id.scoreInfo_xf_value);
viewHolder.jd= (TextView) convertView.findViewById(R.id.scoreInfo_jd_value);
convertView.setTag(viewHolder);
}else{
viewHolder= (MyViewHolder) convertView.getTag();
}
ScoreInfoBean bean=mlist.get(position);
viewHolder.kc.setText(bean.kc);
viewHolder.xn.setText(bean.xn);
viewHolder.xq.setText(bean.xq);
viewHolder.kscs.setText(bean.kscs);
viewHolder.bfzkscj.setText(bean.bfzkscj);
viewHolder.djzkscj.setText(bean.djzkscj);
viewHolder.sftg.setText(bean.sftg);
viewHolder.xf.setText(bean.xf);
viewHolder.jd.setText(bean.jd);
if(bean.djzkscj.equals("不及格")){
viewHolder.kc.setTextColor(context.getResources().getColor(R.color.red));
viewHolder.bfzkscj.setTextColor(context.getResources().getColor(R.color.red));
viewHolder.djzkscj.setTextColor(context.getResources().getColor(R.color.red));
viewHolder.xf.setTextColor(context.getResources().getColor(R.color.red));
viewHolder.jd.setTextColor(context.getResources().getColor(R.color.red));
}
return convertView;