コード例 #1
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   View view = null;
   ViewHolder holder = null;
   if (convertView != null) {
     view = convertView;
     holder = (ViewHolder) view.getTag();
   } else {
     view = View.inflate(context, R.layout.new_product_item, null);
     holder = new ViewHolder();
     holder.tv_xinpin_name = (TextView) view.findViewById(R.id.tv_xinpin_name);
     holder.iv_xinpin_icon = (ImageView) view.findViewById(R.id.iv_xinpin_icon);
     holder.tv_xinpin_date = (TextView) view.findViewById(R.id.tv_xinpin_date);
     view.setTag(holder);
   }
   Good good = newproducts.get(position);
   holder.tv_xinpin_name.setText(good.getName());
   // 设置显示的图标
   showImage(holder.iv_xinpin_icon, good.getPic());
   holder.tv_xinpin_date.setText(good.getShangjiadate());
   // holder.iv_xinpin_icon.setim
   return view;
 }