@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub index = position; final JcInfo info = (JcInfo) mList.get(position); convertView = mInflater.inflate(R.layout.notice_jc_listview_item, null); final ViewHolder holder = new ViewHolder(); holder.time = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_time); holder.team = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team); holder.home = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team_name1); holder.away = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team_name2); holder.letPoint = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_vs); holder.timeEnd = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_time_end); holder.teamId = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_id); holder.result = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_jieguo); holder.score = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_score); convertView.setTag(holder); holder.time.append(info.getTime()); holder.team.append(info.getTeam()); holder.home.append(info.getHome()); holder.away.append(info.getAway()); holder.letPoint.setText(info.getLetPoint()); holder.letPoint.setTextColor(Color.BLUE); holder.timeEnd.append(info.getTimeEnd()); holder.teamId.append(info.getWeek() + info.getTeamId()); holder.result.append(info.getResult()); holder.score.append(info.getScore()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ChatEmoji emoji = mList_chatEmoji.get(position); ViewHolder viewHolder = null; if (convertView == null) { viewHolder = new ViewHolder(); convertView = View.inflate(mContext, R.layout.cgt_layout_chat_emoji_item, null); viewHolder.mIv_emoji = (ImageView) convertView.findViewById(R.id.cgt_iv_chat_item_emoji); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (emoji.getId() == R.drawable.cgt_selector_chat_emoji_del_bg) { // convertView.setBackgroundDrawable(null); viewHolder.mIv_emoji.setImageResource(emoji.getId()); } else if (TextUtils.isEmpty(emoji.getDescription())) { convertView.setBackgroundDrawable(null); viewHolder.mIv_emoji.setImageDrawable(null); } else { viewHolder.mIv_emoji.setTag(emoji); viewHolder.mIv_emoji.setImageResource(emoji.getId()); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // Changed to ViewHolder and Picasso error load as per feedback received ViewHolder holder = new ViewHolder(); // Inflate view if it is null if (convertView == null) { convertView = inflater.inflate(R.layout.grid_item, null); holder.imageView = (ImageView) convertView.findViewById(R.id.movie_poster); MovieDetailDO movie = movieList.get(position); convertView.setTag(holder); Picasso.with(context) .load(movie.getPoster_path()) // .placeholder(R.drawable.def_pos) .error(R.drawable.def_pos) .into(holder.imageView); } else { holder.imageView = (ImageView) convertView.findViewById(R.id.movie_poster); MovieDetailDO movie = movieList.get(position); convertView.setTag(holder); Picasso.with(context) .load(movie.getPoster_path()) // .placeholder(R.drawable.def_pos) .error(R.drawable.def_pos) .into(holder.imageView); } return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; font = Typeface.createFromAsset(this.context.getAssets(), "lato_reg.ttf"); MusicRowItem rowItem = getItem(position); LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (convertView == null) { convertView = mInflater.inflate(R.layout.music_list, null); holder = new ViewHolder(); holder.txtTitle = (TextView) convertView.findViewById(R.id.title); holder.imageView = (ImageView) convertView.findViewById(R.id.icon); holder.Di = (TextView) convertView.findViewById(R.id.SelectedIcon); // TextView ListTitle = (TextView) convertView.findViewById(R.id.title); holder.txtTitle.setTypeface(font); convertView.setTag(holder); } else holder = (ViewHolder) convertView.getTag(); // holder.txtDesc.setText(rowItem.getDesc()); holder.txtTitle.setText(rowItem.getTitle()); holder.imageView.setImageResource(rowItem.getImageId()); // holder.Di.setTypeface(font); /* if(rowItem.getDefault() == true) {*/ holder.Di.setBackgroundResource(R.drawable.notify_pairing); holder.Di.setText("Selected"); holder.Di.setTypeface(font); /*}*/ return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = inflater.inflate(R.layout.list_item_user, null); holder = new ViewHolder(); holder.login = (TextView) convertView.findViewById(R.id.userLogin); holder.add = (CheckBox) convertView.findViewById(R.id.addCheckBox); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } // final QBUser user = dataSource.get(position); final QBUser user = filtered.get(position); if (user != null) { holder.login.setText(user.getLogin()); holder.add.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if ((((CheckBox) v).isChecked())) { selected.add(user); } else { selected.remove(user); } } }); holder.add.setChecked(selected.contains(user)); } return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; User user = getItem(position); LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (convertView == null) { convertView = mInflater.inflate(R.layout.user_list, null); holder = new ViewHolder(); holder.tvUserName = (TextView) convertView.findViewById(R.id.tvuserName); holder.tvUserId = (TextView) convertView.findViewById(R.id.tvuserid); holder.remove = (ImageView) convertView.findViewById(R.id.remove_user); holder.rlBody = (RelativeLayout) convertView.findViewById(R.id.rlbody); convertView.setTag(holder); } else holder = (ViewHolder) convertView.getTag(); holder.remove.setVisibility(View.GONE); if (position % 4 == 0) // holder.rlBody.setBackgroundColor(Color.parseColor("#22b14c")); holder.rlBody.setBackgroundResource(R.drawable.list_background1); else if (position % 4 == 1) holder.rlBody.setBackgroundResource(R.drawable.list_background2); else if (position % 4 == 2) holder.rlBody.setBackgroundResource(R.drawable.list_background3); else if (position % 4 == 3) holder.rlBody.setBackgroundResource(R.drawable.list_background4); holder.tvUserName.setText(user.getUserName()); holder.tvUserId.setText(user.getUserCode()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup viewGroup) { Categorias estadoVO = listCategorias.get(position); ViewHolder holder; if (convertView == null) { convertView = inflater.inflate(idLayout, null); holder = new ViewHolder(); holder.qtdLojas = (TextView) convertView.findViewById(R.id.txtQtdLojas); holder.icone = (ImageView) convertView.findViewById(R.id.imgIcon); holder.title = (TextView) convertView.findViewById(R.id.txtTitle); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.title.setText(estadoVO.getText()); holder.qtdLojas.setText(String.valueOf(estadoVO.getQtdLojas())); holder.icone.setImageResource(estadoVO.getIcon()); int rgb[] = estadoVO.getRgbColor(); holder.title.setBackgroundColor(Color.argb(215, rgb[0], rgb[1], rgb[2])); holder.icone.setBackgroundColor(Color.rgb(rgb[0], rgb[1], rgb[2])); holder.qtdLojas.setBackgroundColor(Color.argb(125, rgb[0], rgb[1], rgb[2])); return convertView; }
@Override public View createView() { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = inflater.inflate(R.layout.app_listview_item_additional, parent, false); holder.app_thumbnails = (ImageView) convertView.findViewById(R.id.iv_app_thumbnails); holder.app_title = (TextView) convertView.findViewById(R.id.tv_app_title); holder.app_add = (Button) convertView.findViewById(R.id.btn_app_add); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.app_thumbnails.setImageDrawable(icon); holder.app_title.setText(appName); holder.app_add.setText("添加"); holder.app_add.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { appItem.doAction(position); /*记录操作 0505*/ OperaEventUtils.recordOperation(OperaEvent.OPERA_DASHBOARD_ADD_LOCAL_APP); } }); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item, parent, false); holder = new ViewHolder(); holder.mTvName = (TextView) convertView.findViewById(R.id.tv_name); holder.mTvPinyin = (TextView) convertView.findViewById(R.id.tv_pinyin); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Girl person = mGirls.get(position); String mFirstPinyin = String.valueOf(person.getPinyin().charAt(0)); String mPreFirstPinyin; if (position == 0) { mPreFirstPinyin = "-"; } else { mPreFirstPinyin = String.valueOf(mGirls.get(position - 1).getPinyin().charAt(0)); } holder.mTvPinyin.setVisibility( !TextUtils.equals(mFirstPinyin, mPreFirstPinyin) ? View.VISIBLE : View.GONE); holder.mTvPinyin.setText(String.valueOf(person.getPinyin().charAt(0))); holder.mTvName.setText(person.getName()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; View view = convertView; if (view == null) { view = LayoutInflater.from(mContext).inflate(R.layout.adapter_nodelist, parent, false); viewHolder = new ViewHolder(); viewHolder.tvDate = (TextView) view.findViewById(R.id.note_date_text); viewHolder.tvTitle = (TextView) view.findViewById(R.id.note_title_text); viewHolder.tvContent = (TextView) view.findViewById(R.id.note_content_text); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } Note note = noteList.get(position); viewHolder.tvTitle.setText(note.getTitle()); viewHolder.tvContent.setText(note.getContent()); viewHolder.tvDate.setText(note.getDateUpdated()); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { // 使用自定义的list_items作为Layout convertView = mInflater.inflate(mResource, parent, false); // 减少findView的次数 holder = new ViewHolder(); // 初始化布局中的元素 holder.itemsIcon = ((ImageView) convertView.findViewById(mTo[0])); holder.itemsTitle = ((TextView) convertView.findViewById(mTo[1])); holder.itemsText = ((TextView) convertView.findViewById(mTo[2])); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } // 获取该行的数据 @SuppressWarnings("unchecked") final Map<String, Object> obj = (Map<String, Object>) mData.get(position); String imageUrl = (String) obj.get("itemsIcon"); holder.itemsTitle.setText((String) obj.get("itemsTitle")); holder.itemsText.setText((String) obj.get("itemsText")); // 设置加载中的View mAbImageDownloader.setLoadingView(convertView.findViewById(R.id.progressBar)); // 图片的下载 mAbImageDownloader.display(holder.itemsIcon, imageUrl); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup arg2) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.item_gallery, null); holder.mImageView = (SqureImageView) convertView.findViewById(R.id.squreImageView); holder.mTextName = (TextView) convertView.findViewById(R.id.textImageName); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } StoredImageBo mageBo = mFilePaths.get(position); File file = new File(mageBo.getmImagePath()); if (file.isFile()) { Bitmap myBitmap = BitmapFactory.decodeFile(mageBo.getmImagePath()); holder.mImageView.setImageBitmap(myBitmap); } else { Bitmap myBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.images_not_found); holder.mImageView.setImageBitmap(myBitmap); } holder.mTextName.setText(mageBo.getmImageName()); return convertView; }
@Override public void bindView(View view) { LayoutInflater mInflater = LayoutInflater.from(mContext); ViewHolder holder = (ViewHolder) view.getTag(); holder.label.removeAllViews(); holder.tag.removeAllViews(); if (mUserTag != null && mUserTag.length > 0) { for (final UserTag userTag : mUserTag) { holder.tagName = (TextView) mInflater.inflate(R.layout.label_name, holder.label, false); holder.tagName.setText(userTag.getTagName()); GradientDrawable drawable = (GradientDrawable) mContext.getResources().getDrawable(R.drawable.corners_bg); if (drawable != null) { drawable.setColor(userTag.parseTagColor()); CompatUtils.setBackground(holder.tagName, drawable); } else { holder.tagName.setBackgroundColor(userTag.parseTagColor()); } holder.tagName.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (interactListener != null) { interactListener.onClick(v, new Interact(userTag)); } } }); holder.label.addView(holder.tagName); } holder.tag.addView(holder.tagView); } }
// A view to hold each row in the list @Override public View getView(int position, View convertView, ViewGroup parent) { // A ViewHolder keeps references to children views to avoid // unneccessary calls // to findViewById() on each row. ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.listviewrow, null); holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.headline); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } // Bind the data efficiently with the holder. // System.out.println("The holder is: " + holder.toString()); holder.text.setText(data[position]); // Set the background color depending of odd/even colorPos result int colorPos = position % colors.length; convertView.setBackgroundColor(colors[colorPos]); return convertView; }
@Override public View getView(int i, View view, ViewGroup viewGroup) { ViewHolder viewHolder; if (view == null) { view = LayoutInflater.from(mContext).inflate(R.layout.item_veterinarias, null); viewHolder = new ViewHolder(); viewHolder.iviLogo = (ImageView) view.findViewById(R.id.iviLogo); viewHolder.tviNombre = (TextView) view.findViewById(R.id.tviNombreVeterinaria); viewHolder.tviDireccion = (TextView) view.findViewById(R.id.tviDireccion); viewHolder.tviTelefono = (TextView) view.findViewById(R.id.tviTelefono); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } Veterinaria veterinaria = mVeterinarias.get(i); viewHolder.iviLogo.setImageResource(R.drawable.patita); viewHolder.tviNombre.setText(veterinaria.getNombre()); viewHolder.tviDireccion.setText(veterinaria.getDireccion()); viewHolder.tviTelefono.setText(veterinaria.getTelefono()); return view; }
public View getView(final int position, View view, ViewGroup arg2) { ViewHolder viewHolder = null; final SortModel mContent = list.get(position); if (view == null) { viewHolder = new ViewHolder(); view = LayoutInflater.from(mContext).inflate(R.layout.item, null); viewHolder.tvTitle = (TextView) view.findViewById(R.id.title); viewHolder.tvLetter = (TextView) view.findViewById(R.id.catalog); viewHolder.headImg = (ImageView) view.findViewById(R.id.headImg); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } // 根据position获取分类的首字母的Char ascii值 int section = getSectionForPosition(position); // 如果当前位置等于该分类首字母的Char的位置 ,则认为是第一次出现 if (position == getPositionForSection(section)) { viewHolder.tvLetter.setVisibility(View.VISIBLE); viewHolder.tvLetter.setText(mContent.getSortLetters()); } else { viewHolder.tvLetter.setVisibility(View.GONE); } viewHolder.tvTitle.setText(this.list.get(position).getName()); imageLoader.DisplayImage(this.list.get(position).getAvater(), viewHolder.headImg); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { // inflate the GridView item layout LayoutInflater inflater = LayoutInflater.from(getContext()); convertView = inflater.inflate(R.layout.fragment_scoreboard, parent, false); // initialize the view holder viewHolder = new ViewHolder(); viewHolder.tvTitle = (TextView) convertView.findViewById(R.id.tvTitle); viewHolder.tvDescription = (TextView) convertView.findViewById(R.id.tvDescription); convertView.setTag(viewHolder); } else { // recycle the already inflated view viewHolder = (ViewHolder) convertView.getTag(); } // update the item view ListViewItem item = getItem(position); viewHolder.tvTitle.setText(item.title); viewHolder.tvDescription.setText(item.description); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.auto_icon_item, null); holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.text); holder.image = (ImageView) convertView.findViewById(R.id.image); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } AutoIconItem item = mItems.get(position); holder.text.setText(item.keyword); if (item.icon != null) { int iconId = mContext .getResources() .getIdentifier(item.icon, "drawable", "com.groupagendas.groupagenda"); holder.image.setImageResource(iconId); } return convertView; }
public View getView(int position, View view, ViewGroup parent) { final ViewHolder holder; positions = position; Log.d(tag, "Adapter Getview"); if (view == null) { Log.d(tag, "if null"); holder = new ViewHolder(); view = inflater.inflate(R.layout.item_lv_viewcustomerinfo, null); holder.address = (TextView) view.findViewById(R.id.item_lv_vcnf_address); holder.name = (TextView) view.findViewById(R.id.item_lv_vcnf_custname); view.setTag(holder); } else { Log.d(tag, "if not null"); holder = (ViewHolder) view.getTag(); } // Capture position and set to the TextViews holder.address.setText(ItemList.get(position).getAddress()); // reversed this// holder.name.setText(ItemList.get(position).getContact_name()); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; // If we have to create the view from scratch if (convertView == null) { // Inflate view LayoutInflater inflater = ((Activity) context).getLayoutInflater(); convertView = inflater.inflate(R.layout.nav_drawer_item, parent, false); // Setup viewholder viewHolder = new ViewHolder(); viewHolder.title = (TextView) convertView.findViewById(R.id.nav_item_title); viewHolder.icon = (ImageView) convertView.findViewById(R.id.nav_item_icon); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } String navItemTitle = getItem(position); if (navItemTitle != null) { viewHolder.title.setText(navItemTitle); viewHolder.icon.setImageResource(GetIcon(navItemTitle, position == selected)); viewHolder.icon.setAlpha((position == selected ? 0.54f : 0.26f)); } return convertView; }
// Metodo donde sacaremos la información necesaria para crear la lista public View getView(int position, View convertView, ViewGroup parent) { Medicamento m = getItem(position); ViewHolder viewHolder; if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(this.context); convertView = inflater.inflate(R.layout.fila_tratamiento, parent, false); viewHolder = new ViewHolder(); viewHolder.medicamento = (TextView) convertView.findViewById(R.id.nTratamiento); viewHolder.tomasTotales = (TextView) convertView.findViewById(R.id.tvFechaInicio); viewHolder.tomasRestantes = (TextView) convertView.findViewById(R.id.tvFechaFinal); viewHolder.siguienteToma = (TextView) convertView.findViewById(R.id.tvRestantes); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.medicamento.setText(m.getnMedicamento()); viewHolder.tomasTotales.setText("Total tomas: " + m.getTotalTomas()); viewHolder.tomasRestantes.setText("Tomas restantes: " + m.getTomas()); Date fecha = new Date(m.getSiguienteHora()); SimpleDateFormat format = new SimpleDateFormat("HH:mm"); viewHolder.siguienteToma.setText(String.valueOf("Siguiente Toma: " + format.format(fecha))); return convertView; }
@Override public View getView(int position, View view, ViewGroup parent) { // TODO Auto-generated method stub if (view == null) { holder = new ViewHolder(); view = LayoutInflater.from(context).inflate(R.layout.item_inform, null); holder.tv_announce_text = (TextView) view.findViewById(R.id.tv_announce_text_item); holder.tv_announce_date = (TextView) view.findViewById(R.id.tv_announce_date_item); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } if (isOrigin == false) { // 判断角色 if (position < Integer.parseInt(messageCount)) { holder.tv_announce_text.setTextColor(getResources().getColor(R.color.inform_first_text)); } } holder.tv_announce_text.setText( (CharSequence) list.get(position).get("tv_announcement_text")); holder.tv_announce_date.setText( (CharSequence) list.get(position).get("tv_announcement_date")); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { // Get the data item for this position File file = getItem(position); // Check if an existing view is being reused, otherwise inflate the view ViewHolder viewHolder; // view lookup cache stored in tag if (convertView == null) { viewHolder = new ViewHolder(); LayoutInflater inflater = LayoutInflater.from(getContext()); convertView = inflater.inflate(R.layout.contact_item, parent, false); viewHolder.name = (TextView) convertView.findViewById(R.id.name); viewHolder.createdAt = (TextView) convertView.findViewById(R.id.occupation); viewHolder.image = (ImageView) convertView.findViewById(R.id.image); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } // Populate the data into the template view using the data object viewHolder.name.setText(file.getFileName()); SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); try { Date date = isoFormat.parse(file.getCreatedAt()); SimpleDateFormat outputDateFormat = new SimpleDateFormat("MM/dd/yyyy", Locale.US); viewHolder.createdAt.setText(outputDateFormat.format(date)); } catch (ParseException e) { viewHolder.createdAt.setText(file.getCreatedAt()); } int[] images = {R.drawable.file_icon, R.drawable.image_icon}; int selected = images[file.getFileName().charAt(0) % 2]; viewHolder.image.setImageBitmap(BitmapFactory.decodeResource(parent.getResources(), selected)); // Return the completed view to render on screen return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; ViewHolder holder; if (convertView == null) { vi = inflater.inflate(R.layout.aktywnosc_item_list, null); holder = new ViewHolder(); holder.text_nazwa = (TextView) vi.findViewById(R.id.textAktywnoscNazwa); holder.text_data = (TextView) vi.findViewById(R.id.textAktywnoscData); holder.text_koszt = (TextView) vi.findViewById(R.id.textAktywnoscKwota); vi.setTag(holder); } else holder = (ViewHolder) vi.getTag(); holder.text_nazwa.setText(this.list_nazwa.get(position)); holder.text_data.setText(this.list_data.get(position)); if (this.list_rodzaj.get(position).equals("wydatek")) { // #D40000 holder.text_koszt.setText( Html.fromHtml( "<font color='#ffffff'><b>- " + formatter.format(this.list_koszt.get(position)) + " z³</b></font>")); holder.text_koszt.setBackgroundColor(Color.RED); } else { // #55AB3D holder.text_koszt.setText( Html.fromHtml( "<font color='#ffffff'><b>+ " + formatter.format(this.list_koszt.get(position)) + " z³</b></font>")); holder.text_koszt.setBackgroundColor(Color.GREEN); } return vi; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = inflater.inflate(R.layout.page, parent, false); holder.text = (TextView) convertView.findViewById(R.id.text); holder.firstPage = (Button) convertView.findViewById(R.id.first_page); holder.lastPage = (Button) convertView.findViewById(R.id.last_page); holder.firstPage.setOnClickListener(this); holder.lastPage.setOnClickListener(this); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.text.setText("" + position); convertView.setBackgroundColor(getColor(position)); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; long duree; if (convertView == null) { holder = new ViewHolder(); convertView = inflater.inflate(R.layout.history_list_item, parent, false); holder.date = (TextView) convertView.findViewById(R.id.history_list_item_date); holder.period = (TextView) convertView.findViewById(R.id.history_list_item_period); holder.hours = (TextView) convertView.findViewById(R.id.history_list_item_hours); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.date.setText(dateFormat.format(tataDays.get(position).getDate())); holder.period.setText( hoursFormat.format(tataDays.get(position).getBegin()) + " - " + hoursFormat.format(tataDays.get(position).getEnd())); duree = tataDays.get(position).getEnd().getTime() - tataDays.get(position).getBegin().getTime(); holder.hours.setText(Utility.convertSecondsToHHMmSs(duree)); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; ViewHolder holder; if (convertView == null) { view = inflater.inflate(R.layout.grid_list_layout, null); holder = new ViewHolder(); holder.adIcon = (ImageView) view.findViewById(R.id.adIcon); holder.adType = (TextView) view.findViewById(R.id.adType); holder.adSize = (TextView) view.findViewById(R.id.adSize); holder.adClientId = (TextView) view.findViewById(R.id.adClientId); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } ListItem listItem = this.getItem(position); holder.adIcon.setImageResource(listItem.getAdIcon()); holder.adType.setText(listItem.getAdType()); holder.adSize.setText(listItem.getAdSize()); holder.adClientId.setText(listItem.getAdClientId()); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.disk_list_item, null); viewHolder = new ViewHolder(); viewHolder.textView = (TextView) convertView.findViewById(R.id.disk_text); viewHolder.textSize = (TextView) convertView.findViewById(R.id.disk_text_size); viewHolder.linearLayout = (LinearLayout) convertView.findViewById(R.id.disk_lin); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (selectedPosition == position) { viewHolder.textView.setSelected(true); viewHolder.linearLayout.setBackgroundColor(context.getResources().getColor(R.color.skyblue)); } else { viewHolder.textView.setSelected(false); viewHolder.linearLayout.setBackgroundColor(Color.TRANSPARENT); } viewHolder.textView.setText(list.get(position).getFileName()); viewHolder.textSize.setText("剩余:" + list.get(position).getFreeSpace()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup arg2) { // TODO Auto-generated method stub ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(context).inflate(R.layout.sales_ware_summer_list_item, null); holder.textView1 = (TextView) convertView.findViewById(R.id.waresummer_kuanhao); holder.textView2 = (TextView) convertView.findViewById(R.id.waresummer_count); holder.textView3 = (TextView) convertView.findViewById(R.id.waresummer_money); holder.textView4 = (TextView) convertView.findViewById(R.id.waresummer_mincheng); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Order order = list.get(position); holder.textView1.setText(order.getOrderDate()); holder.textView2.setText(order.getCardNum()); holder.textView3.setText(order.getKuanHao()); holder.textView4.setText(order.getKuanHao()); int[] colors = {Color.WHITE, Color.rgb(219, 238, 244)}; // RGB颜色 convertView.setBackgroundColor(colors[position % 2]); // 每隔item之间颜色不同 return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(mContext).inflate(R.layout.list_item_album, null, false); holder.album_name = (TextView) convertView.findViewById(R.id.album_name); holder.num_of_tracks = (TextView) convertView.findViewById(R.id.num_of_tracks_in_album); holder.album_picture = (ImageView) convertView.findViewById(R.id.album_picture); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.album_name.setText(getItem(position).getAlbumName()); holder.num_of_tracks.setText("" + getItem(position).getNumberOfSongs()); // 加载专辑封面 if (getItem(position).getArtWork() == null) { holder.album_picture.setImageResource(R.drawable.default_list_album); } else { Bitmap bm = BitmapFactory.decodeFile(getItem(position).getArtWork()); BitmapDrawable bmpDraw = new BitmapDrawable(bm); holder.album_picture.setImageDrawable(bmpDraw); Log.i(TAG, "getView()--->ArtWork=" + getItem(position).getArtWork()); } return convertView; }