Ejemplo n.º 1
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   MyHolder holder = null;
   if (null == convertView) {
     convertView = LayoutInflater.from(context).inflate(R.layout.browse_history_lv_item, null);
     holder = new MyHolder();
     holder.iv_pro = (ImageView) convertView.findViewById(R.id.iv_pro);
     holder.tv_pro_name = (TextView) convertView.findViewById(R.id.tv_pro_name);
     holder.tv_price = (TextView) convertView.findViewById(R.id.tv_price);
     holder.tv_sprice = (TextView) convertView.findViewById(R.id.tv_sprice);
     convertView.setTag(holder);
   } else {
     holder = (MyHolder) convertView.getTag();
   }
   ImageManager.Load(data.get(position).img, holder.iv_pro);
   holder.tv_pro_name.setText(data.get(position).name);
   Spanned sprice =
       Html.fromHtml(
           ResourceUtils.changeStringColor(
               "#C30001", MathUtil.priceForAppWithSign(data.get(position).price)));
   holder.tv_price.setText(sprice);
   holder.tv_sprice.setText("已销售" + data.get(position).sales_num + "双");
   return convertView;
 }
Ejemplo n.º 2
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View row = convertView;
      MyHolder holder = null;

      if (row == null) {
        LayoutInflater inflater = getLayoutInflater();
        row = inflater.inflate(R.layout.driver_service_item, parent, false);
        holder = new MyHolder();
        holder.title = (TextView) row.findViewById(R.id.title);
        holder.ic_check = (ImageView) row.findViewById(R.id.ic_check);
        holder.thumb = (ImageView) row.findViewById(R.id.thumb);
        holder.rate = (ImageView) row.findViewById(R.id.rate);
        holder.layout = (RelativeLayout) row.findViewById(R.id.service_item_layout);
        row.setTag(holder);
      } else {
        holder = (MyHolder) row.getTag();
      }

      Supplier item = mList.get(position);
      holder.title.setText(item.name);
      // holder.thumb.setImageResource(item.thumb);
      ImageLoader.getInstance().displayImage(item.image, holder.thumb, options);
      if (checked.get(item.id) != null) {
        holder.ic_check.setImageResource(R.drawable.check);
      } else {
        holder.ic_check.setImageResource(R.drawable.uncheck);
      }

      try {
        Log.e("Tuan", "star" + item.avg_rate);
        int resID =
            getResources().getIdentifier("star" + item.avg_rate, "drawable", getPackageName());
        Log.e("Tuan", "star" + item.avg_rate + " " + resID);
        holder.rate.setImageDrawable(getResources().getDrawable(resID));
      } catch (Exception e) {
        e.printStackTrace();
      }

      if (position % 2 == 0) {
        holder.layout.setBackgroundColor(Color.parseColor("#aaffffff"));
      } else {
        holder.layout.setBackgroundColor(Color.parseColor("#aaf1f0ec"));
      }

      return row;
    }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    MyHolder holder = null;

    if (convertView == null) {
      holder = new MyHolder();
      convertView = LayoutInflater.from(context).inflate(R.layout.ui_famous_item, null);
      holder.logo = (ImageView) convertView.findViewById(R.id.att_logo);
      holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name);
      holder.tv_notice = (TextView) convertView.findViewById(R.id.tv_notice);
      holder.tv_fans = (TextView) convertView.findViewById(R.id.tv_fans);
      holder.iv_guanzhu = (ImageView) convertView.findViewById(R.id.iv_guanzhu);
      convertView.setTag(holder);
    } else {
      holder = (MyHolder) convertView.getTag();
    }

    final MyHolder finalHolder = holder;
    holder.iv_guanzhu.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finalHolder.iv_guanzhu.setImageResource(R.drawable.yiguanzhu);
          }
        });
    Famous famous = list.get(position);
    holder.tv_name.setText(famous.getNinkName());
    holder.tv_notice.setText(famous.getNotice());
    holder.tv_fans.setText(famous.getFans() + "人关注" + "" + " | " + famous.getLevel());
    Glide.with(context)
        .load(famous.getHeadFace())
        .bitmapTransform(new CropCircleTransformation(context))
        .into(holder.logo);

    return convertView;
  }