@Override public View getView(final int position, View convertView, final ViewGroup parent) { final ViewHolder viewHolder; if (convertView == null) { LayoutInflater vi = (LayoutInflater) base.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = vi.inflate(R.layout.item_reminder, parent, false); viewHolder = new ViewHolder(); convertView.setTag(viewHolder); viewHolder.title = (TextView) convertView.findViewById(R.id.textViewReminderTitle); viewHolder.text = (TextView) convertView.findViewById(R.id.textViewReminderText); viewHolder.time = (TextView) convertView.findViewById(R.id.textViewReminderTime); } else { viewHolder = (ViewHolder) convertView.getTag(); } String s = reminderList.get(position); String[] tokens = s.split(","); viewHolder.index = position; viewHolder.title.setText(tokens[1]); viewHolder.text.setText(tokens[2]); viewHolder.time.setText(tokens[3]); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = new ViewHolder(); if (convertView == null) { convertView = inflater.inflate(R.layout.community_listview_item, null); holder.intro = (TextView) convertView.findViewById(R.id.shequ_item_activities); holder.title = (TextView) convertView.findViewById(R.id.shequ_item_name); holder.time = (TextView) convertView.findViewById(R.id.shequ_hot_item_time); holder.actimg = (ImageView) convertView.findViewById(R.id.shequ_head_pic_item); holder.shequ_item_activities_detail = (TextView) convertView.findViewById(R.id.shequ_item_activities_detail); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); CommunityListbean listbean = list.get(position); holder.title.setText(listbean.getTitle()); holder.time.setVisibility(View.VISIBLE); holder.time.setText(listbean.getTime()); holder.shequ_item_activities_detail.setVisibility(View.GONE); holder.intro.setText(listbean.getDttype()); String actimg = list.get(position).getActimg(); // Picasso.with(context).load(Constant.COMMUNITY_IMAGE_URL+userpic).into(holder.userpic); bitmap.display( holder.actimg, Constant.COMMUNITY_IMAGE_URL + actimg, 40, 80, loadingBitmap, laodfailBitmap); } return convertView; }
public View getViewMedia(int position, View convertView, ViewGroup parent) { View v = convertView; ViewHolder holder; /* convertView may be a recycled view but we must recreate it * if it does not correspond to a media view. */ boolean b_createView = true; if (v != null) { holder = (ViewHolder) v.getTag(); if (holder.viewType == VIEW_MEDIA) b_createView = false; } if (b_createView) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(R.layout.audio_browser_item, parent, false); holder = new ViewHolder(); holder.layout = v.findViewById(R.id.layout_item); holder.title = (TextView) v.findViewById(R.id.title); Util.setAlignModeByPref(mAlignMode, holder.title); holder.cover = (ImageView) v.findViewById(R.id.cover); holder.subtitle = (TextView) v.findViewById(R.id.subtitle); holder.footer = v.findViewById(R.id.footer); holder.more = (ImageView) v.findViewById(R.id.item_more); holder.viewType = VIEW_MEDIA; v.setTag(holder); } else holder = (ViewHolder) v.getTag(); ListItem item = getItem(position); holder.title.setText(item.mTitle); RelativeLayout.LayoutParams paramsCover; if (mItemType == ITEM_WITH_COVER) { Media media = mItems.get(position).mMediaList.get(0); Bitmap cover = AudioUtil.getCover(v.getContext(), media, 64); if (cover == null) cover = BitmapCache.GetFromResource(v, R.drawable.icon); holder.cover.setImageBitmap(cover); int size = (int) mContext.getResources().getDimension(R.dimen.audio_browser_item_size); paramsCover = new RelativeLayout.LayoutParams(size, size); } else paramsCover = new RelativeLayout.LayoutParams(0, RelativeLayout.LayoutParams.WRAP_CONTENT); holder.cover.setLayoutParams(paramsCover); holder.subtitle.setVisibility(item.mSubTitle == null ? TextView.GONE : TextView.VISIBLE); holder.subtitle.setText(item.mSubTitle); // Remove the footer if the item is just above a separator. holder.footer.setVisibility(isMediaItemAboveASeparator(position) ? View.GONE : View.VISIBLE); final int pos = position; holder.more.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { if (mContextPopupMenuListener != null) mContextPopupMenuListener.onPopupMenu(v, pos); } }); return v; }
@Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.list_item_google_cards_travel, parent, false); holder = new ViewHolder(); holder.image = (ImageView) convertView.findViewById(R.id.list_item_google_cards_travel_image); holder.categoryName = (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_category_name); holder.title = (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_title); holder.text = (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_text); holder.explore = (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_explore); holder.share = (TextView) convertView.findViewById(R.id.list_item_google_cards_travel_share); holder.explore.setOnClickListener(this); holder.share.setOnClickListener(this); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } item = getItem(position); ImageUtil.displayImage(holder.image, item.getmImageURL(), null); holder.title.setText(item.getName()); holder.text.setText(item.getmDescription()); holder.explore.setTag(position); holder.categoryName.setText(item.getCategory()); holder.share.setTag(position); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.movie_list_item, parent, false); viewHolder = new ViewHolder(); viewHolder.image = (ImageView) convertView.findViewById(R.id.poster); viewHolder.title = (TextView) convertView.findViewById(R.id.title); convertView.setTag(viewHolder); } viewHolder = (ViewHolder) convertView.getTag(); MovieModel movie = getItem(position); if (movie.getCachedPosterPath() == null) { movie.setCachedPosterPath( "http://image.tmdb.org/t/p/w" + String.valueOf(imageWidth) + "/" + movie.getPosterPath()); } viewHolder.title.setText(movie.getTitle()); viewHolder.image.setMinimumHeight(imageHeight); viewHolder.image.setMinimumWidth(imageWidth); Picasso.with(getContext()).load(movie.getCachedPosterPath()).into(viewHolder.image); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.recommend_item, null); holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.recommend_item_title); holder.title_line = (ImageView) convertView.findViewById(R.id.recommend_item_title_line); holder.icon = (ImageView) convertView.findViewById(R.id.recommend_item_icon); holder.name = (TextView) convertView.findViewById(R.id.recommend_item_name); holder.description = (TextView) convertView.findViewById(R.id.recommend_item_description); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } RecommendResult result = mResults.get(position); if (mIsOfficial) { holder.description.setVisibility(View.GONE); if (result.isTitle()) { holder.title.setVisibility(View.VISIBLE); holder.title_line.setVisibility(View.VISIBLE); holder.title.setText(result.getTitleName()); } else { holder.title.setVisibility(View.GONE); holder.title_line.setVisibility(View.GONE); } } else { holder.description.setVisibility(View.VISIBLE); holder.title.setVisibility(View.GONE); holder.title_line.setVisibility(View.GONE); holder.description.setText(result.getDescription()); } holder.icon.setImageBitmap(mKXApplication.getRecommend(result.getIcon())); holder.name.setText(result.getName()); return convertView; }
/** * Make a view to hold each row. * * @see android.widget.ListAdapter getView(int, android view View, android view ViewGroup) */ 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; // When convertView is not null, we can reuse it directly, there is no // need // to reinflate it. We only inflate a new View when the convertView // supplied // by ListView is null. if (convertView == null) { convertView = mInflater.inflate(R.layout.list_item_coupon, null); // Creates a ViewHolder and store references to the two children // views // we want to bind data to. holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.article_title); holder.subtitle = (TextView) convertView.findViewById(R.id.article_byline); holder.thumbnail = (ImageView) convertView.findViewById(R.id.photo); convertView.setTag(holder); } else { // Get the ViewHolder back to get fast access to the TextView // and the ImageView. holder = (ViewHolder) convertView.getTag(); } holder.title.setText(DATA.get(position).getCompany()); holder.subtitle.setText(DATA.get(position).getDescription()); holder.thumbnail.setImageResource(DATA.get(position).getLogo()); return convertView; }
@Override public View getView(final int position, View convertView, final ViewGroup parent) { // A ViewHolder keeps references to children views to avoid unnecessary // calls to findViewById() on each row. ViewHolder holder; // When convertView is not null, we can reuse it directly, there is no // need // to reinflate it. We only inflate a new View when the convertView // supplied // by ListView is null. if (convertView == null) { convertView = mInflater.inflate(R.layout.exception_list_item, null); // Creates a ViewHolder and store references to the two children // views // we want to bind data to. holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.exception_title); holder.body = (TextView) convertView.findViewById(R.id.exception_text); convertView.setTag(holder); } else holder = (ViewHolder) convertView.getTag(); /* * Bind the data efficiently with the holder. */ holder.title.setText(getItem(position).getName()); holder.body.setText(getItem(position).getValue()); return convertView; }
/* * (non-Javadoc) * * @方法: getView * * @描述: * * @param position * * @param convertView * * @param parent * * @return * * @see android.widget.Adapter#getView(int, android.view.View, * android.view.ViewGroup) */ @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(context) .inflate(R.layout.gip_mine_suggestion_my_info_list_layout, null); holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.gip_mine_sug_my_info_title); holder.beginTime = (TextView) convertView.findViewById(R.id.gip_mine_sug_my_info_begintime); holder.endTime = (TextView) convertView.findViewById(R.id.gip_mine_sug_my_info_endtime); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.title.setText((position + 1) + ". 标题:" + politicss.get(position).getTitle()); holder.beginTime.setText("发布时间:" + politicss.get(position).getBeginTime()); holder.endTime.setText("截至时间:" + politicss.get(position).getEndTime()); return convertView; }
public View getView(int position, View view, ViewGroup parent) { View convertView = view; // m.get(position); ViewHolder holder = null; if (convertView == null) { convertView = inflater.inflate(R.layout.relative_topic_list, null); TextView num = (TextView) convertView.findViewById(R.id.num); TextView title = (TextView) convertView.findViewById(R.id.title); TextView author = (TextView) convertView.findViewById(R.id.author); TextView lastReply = (TextView) convertView.findViewById(R.id.last_reply); holder = new ViewHolder(); holder.num = num; holder.title = title; holder.author = author; holder.lastReply = lastReply; convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } ThemeManager cfg = ThemeManager.getInstance(); int colorId = cfg.getBackgroundColor(position); if (position == this.selected) { if (cfg.mode == ThemeManager.MODE_NIGHT) colorId = R.color.topiclist_selected_color; else colorId = R.color.holo_blue_light; ; } convertView.setBackgroundResource(colorId); handleJsonList(holder, position); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(getContext()); convertView = inflater.inflate(R.layout.list_view_activitybook_adapter, parent, false); viewHolder = new ViewHolder(); viewHolder.title = (TextView) convertView.findViewById(R.id.tvTitle); viewHolder.date = (TextView) convertView.findViewById(R.id.tvDate); viewHolder.active = (TextView) convertView.findViewById(R.id.tvActive); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } Activitybook item = getItem(position); viewHolder.title.setText(item.getName()); viewHolder.date.setText("Created On: " + item.getCreatedAt()); if (item.getActive() != null && item.getActive().equals("1")) viewHolder.active.setText("Active"); else viewHolder.active.setText("Inactive"); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = getActivity().getLayoutInflater().inflate(R.layout.simple_list_item_with_icon, null); holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.title); holder.title.setTypeface(tfb); holder.text = (TextView) convertView.findViewById(R.id.text); holder.text.setTypeface(tf); holder.icon = (ImageView) convertView.findViewById(R.id.icon); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } ForecastItem o = items.get(position); holder.title.setText(o.getDay()); holder.text.setText(o.getForecastText()); holder.icon.setImageResource(o.getWeatherIcon()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; ViewHolder holder; if (row == null) { row = inflater.inflate(R.layout.item_project, parent, false); holder = new ViewHolder(); if (row != null) { holder.image = (ImageView) row.findViewById(R.id.projectImage); holder.title = (TextView) row.findViewById(R.id.txt_project_title); holder.description = (TextView) row.findViewById(R.id.txt_project_description); holder.likes = (TextView) row.findViewById(R.id.txt_project_likes); row.setTag(holder); } } else { holder = (ViewHolder) row.getTag(); } Project item = getItem(position); holder.title.setText(item.getTitle()); holder.description.setText(item.getDescription()); holder.likes.setText(String.format("%d", item.getLikes())); AQuery itemAq = aq.recycle(row); if (item.getPicture().length() > 0) itemAq.id(holder.image).image(item.getPicture()); return row; }
@Override public View getView(int position, View convertView, ViewGroup parent) { Video item = getItem(position); ViewHolder holder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.item_history, parent, false); holder = new ViewHolder(); holder.channel = (TextView) convertView.findViewById(R.id.channel); holder.title = (TextView) convertView.findViewById(R.id.title); holder.time = (TextView) convertView.findViewById(R.id.time); holder.image = (NetworkImageView) convertView.findViewById(R.id.image); holder.image.setDefaultImageResId(R.drawable.cover_night); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (mActivity instanceof HomeActivity) { String channel = ((HomeActivity) mActivity).findChannelNameById(item.channelId); holder.channel.setText(channel); } holder.title.setText(item.name); holder.time.setText("浏览于 " + AcApp.getPubDate(item.createtime)); holder.image.setImageUrl(item.previewurl, AcApp.getGloableLoader()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder viewHolder; if (convertView == null) { convertView = inflater.inflate(R.layout.item_selectlocation, null); viewHolder = new ViewHolder(); viewHolder.title = (TextView) convertView.findViewById(R.id.selectlocation_item_title); viewHolder.detail = (TextView) convertView.findViewById(R.id.selectlocation_item_detail); viewHolder.icon = (ImageView) convertView.findViewById(R.id.selectlocation_item_icon); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } LocationPoint point = locationList.get(position); if (position == 0) { viewHolder.title.setText("[ 位置 ]"); } else { viewHolder.title.setText(point.getTitle()); } viewHolder.detail.setText(point.getDetail()); if (point.isSelected) { viewHolder.icon.setVisibility(View.VISIBLE); } else { viewHolder.icon.setVisibility(View.GONE); } return convertView; }
@Override public View getView(int position, View converView, ViewGroup viewGrop) { ViewHolder vh = null; if (converView == null) { vh = new ViewHolder(); converView = LayoutInflater.from(context).inflate(R.layout.item, null); vh.title = (TextView) converView.findViewById(R.id.title); vh.content = (TextView) converView.findViewById(R.id.content); vh.imageView = (ImageView) converView.findViewById(R.id.imageView1); converView.setTag(vh); } else { vh = (ViewHolder) converView.getTag(); } Alpha bean = getItem(position); vh.title.setText(bean.title); vh.content.setText(bean.content); vh.imageView.setImageResource(bean.imageViewId); if (bean.type == Alpha.SECTION) { vh.title.setBackgroundResource(R.drawable.bao_headview_bg); vh.imageView.setVisibility(View.GONE); vh.title.setTextSize(14); vh.content.setVisibility(View.GONE); } else { vh.title.setBackgroundResource(R.drawable.details_layout_bg); vh.imageView.setVisibility(View.VISIBLE); } return converView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = mLayoutInflater.inflate(LAYOUT, null); viewHolder = new ViewHolder(); viewHolder.title = (TextView) convertView.findViewById(R.id.title); viewHolder.poster = (ImageView) convertView.findViewById(R.id.poster); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } // set text properties immediately Movie item = getItem(position); viewHolder.title.setText(item.title); if (item.poster_path != null) { // TODO get image path from TMDb, not static String posterPath = "http://cf2.imgobject.com/t/p/w185" + item.poster_path; mImageDownloader.download(posterPath, viewHolder.poster, false); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { Context ctx = AppGlobals.getContext(); LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.list_item, parent, false); holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.txt_data); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } SmbFile file = getItem(position); holder.title.setText(file.getName()); try { if (file.isFile()) { float sizeToMbs = (float) file.length() / 100000; String sizeString = String.format("%fmb", sizeToMbs); // holder.size.setText(String.valueOf(sizeString)); } } catch (SmbException e) { e.printStackTrace(); } return convertView; }
@Override public View getView(int position, View view, ViewGroup arg2) { ViewHolder viewHolder; if (view == null) { viewHolder = new ViewHolder(); view = getLayoutInflater().inflate(R.layout.item_traderesult, null); viewHolder.title = (TextView) view.findViewById(R.id.product_title); viewHolder.time = (TextView) view.findViewById(R.id.product_time); viewHolder.status = (TextView) view.findViewById(R.id.product_status); viewHolder.product_status = (TextView) view.findViewById(R.id.product_trade_status); viewHolder.money = (TextView) view.findViewById(R.id.product_money); view.setTag(viewHolder); } else { viewHolder = (ViewHolder) view.getTag(); } JSONObject item = getItem(position); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); viewHolder.time.setText(sdf.format(item.optLong("tradeTime"))); if (item.optString("tradeStatus").equals("0")) { viewHolder.status.setText("交易中"); } else if (item.optString("tradeStatus").equals("1")) { viewHolder.status.setText("成功"); } else { viewHolder.status.setText("失败"); } viewHolder.product_status.setText(item.optString("tradeType")); viewHolder.title.setText(item.optString("proName")); viewHolder.money.setText( Html.fromHtml("<font color=#ff0000>" + item.optString("tradeMoney") + "</font>" + "元")); return view; }
public View getViewSeparator(int position, View convertView, ViewGroup parent) { View v = convertView; ViewHolder holder; /* convertView may be a recycled view but we must recreate it * if it does not correspond to a separator view. */ boolean b_createView = true; if (v != null) { holder = (ViewHolder) v.getTag(); if (holder.viewType == VIEW_SEPARATOR) b_createView = false; } if (b_createView) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = inflater.inflate(R.layout.audio_browser_separator, parent, false); holder = new ViewHolder(); holder.layout = v.findViewById(R.id.layout_item); holder.title = (TextView) v.findViewById(R.id.title); holder.viewType = VIEW_SEPARATOR; v.setTag(holder); } else holder = (ViewHolder) v.getTag(); ListItem item = getItem(position); holder.title.setText(item.mTitle); return v; }
@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 getView(final int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; final String myProfile = getItem(position); if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); convertView = inflater.inflate(R.layout.profile_drawer_item, parent, false); viewHolder = new ViewHolder(); viewHolder.title = (TextView) convertView.findViewById(R.id.myprofile_title); viewHolder.imageIcon = (ImageView) convertView.findViewById(R.id.ivIcon); viewHolder.lvMyProfileItem = (LinearLayout) convertView.findViewById(R.id.lvMyProfileItem); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.title.setText(myProfile); viewHolder.lvMyProfileItem.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { context.left_drawer.setItemChecked(position, true); context.drawer_layout.closeDrawer(context.left_drawer); } }); return convertView; }
@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; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (convertView == null) { // inflate the layout LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.fragment_list_item_transition, null); // well set up the ViewHolder viewHolder = new ViewHolder(); viewHolder.title = (TextView) v.findViewById(R.id.item_title); viewHolder.descr = (TextView) v.findViewById(R.id.item_description); // store the holder with the view. v.setTag(viewHolder); } else { // just use the viewHolder viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.title.setText(mCategories.get(position).getName()); viewHolder.descr.setText("" + mCategories.get(position).getSize()); return v; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; final Position pos = posArray[position]; if (convertView == null) { convertView = mInflater.inflate(R.layout.position, null); holder = new ViewHolder(); holder.companyName = (TextView) convertView.findViewById(R.id.companyName); holder.industry = (TextView) convertView.findViewById(R.id.industry); holder.title = (TextView) convertView.findViewById(R.id.title); convertView.setTag(holder); } else { // Get the ViewHolder back to get fast access to the TextView // and the ImageView. holder = (ViewHolder) convertView.getTag(); } holder.companyName.setText(pos.getCompanyName()); holder.industry.setText(pos.getIndustry()); holder.title.setText(pos.getTitle()); return convertView; }
// populates the view with input data @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; // if (convertView == null) { LayoutInflater inflater = getLayoutInflater(); convertView = inflater.inflate(R.layout.activity_chat_singlemessage, parent, false); holder = new ViewHolder(); holder.layout = (LinearLayout) convertView.findViewById(R.id.singleMessageContainer); holder.title = (TextView) holder.layout.findViewById(R.id.singleMessage); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (!messages.isEmpty()) { if (messages.get(position).get("direction").equals("0")) { // msg bubble onto right holder.layout.setGravity(Gravity.RIGHT); holder.title.setBackgroundResource(R.drawable.bubble_b); } else { // msg bubble onto left holder.layout.setGravity(Gravity.LEFT); holder.title.setBackgroundResource(R.drawable.bubble_a); } holder.title.setText((String) messages.get(position).get("body")); } return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; int type = getItemViewType(position); Event event = events.get(position); if (convertView == null) { holder = new ViewHolder(); switch (type) { case DAY: convertView = mInflater.inflate(R.layout.day_item, null); holder.day = (TextView) convertView.findViewById(R.id.day_title); break; case EVENT: convertView = mInflater.inflate(R.layout.search_list_item, null); holder.hour = (TextView) convertView.findViewById(R.id.event_hour); holder.title = (TextView) convertView.findViewById(R.id.event_title); holder.image = (ImageView) convertView.findViewById(R.id.event_favorite); holder.row = (LinearLayout) convertView.findViewById(R.id.event_row); holder.eventId = event.getId(); break; } convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (event != null) { if (event.getExternalId() == 0) { String dayText = BaseActivity.getDateFromTimestamp(event.getDate(), context); holder.day.setText(dayText); } else { // Hour. String hour = event.getStartHour(); if (hour.length() == 0) { hour = context.getString(R.string.event_whole_day); } holder.hour.setText(hour); // Title. String title = event.getTitle(); holder.title.setText(title); // Favorite. if (event.getFavorite() == 0) { holder.image.setImageResource(R.drawable.fav_off_small); } else { holder.image.setImageResource(R.drawable.fav_on_small); } holder.eventId = event.getId(); convertView.setOnTouchListener(eventTouch); } } return convertView; }
public static ViewHolder newViewHolder(View view) { ViewHolder viewHolder = new ViewHolder(); viewHolder.img = (ImageView) view.findViewById(R.id.image_coin_icon); viewHolder.title = (TextView) view.findViewById(R.id.tv_coin_name); viewHolder.tvNum = (TextView) view.findViewById(R.id.tv_zengzhi_used_count); viewHolder.btnAction = (TextView) view.findViewById(R.id.btn_zengzhi_action); viewHolder.image_arrow = view.findViewById(R.id.image_arrow); return viewHolder; }
public View newView(Context paramContext, Cursor paramCursor, ViewGroup paramViewGroup) { View localView1 = super.newView(paramContext, paramCursor, paramViewGroup); ViewHolder localViewHolder = new ViewHolder(); Document localDocument = new Document(); localViewHolder.document = localDocument; StatefulShadowTextView localStatefulShadowTextView1 = (StatefulShadowTextView)localView1.findViewById(2131296326); localViewHolder.title = localStatefulShadowTextView1; if (localViewHolder.title == null) { StatefulShadowTextView localStatefulShadowTextView2 = (StatefulShadowTextView)localView1.findViewById(2131296347); localViewHolder.title = localStatefulShadowTextView2; } View localView2 = localView1.findViewById(2131296412); localViewHolder.comboColumn = localView2; View localView3 = localView1.findViewById(2131296546); localViewHolder.contextMenu = localView3; View localView4 = localViewHolder.contextMenu; View.OnClickListener localOnClickListener = this.mContextClickListener; localView4.setOnClickListener(localOnClickListener); AsyncAlbumArtImageView localAsyncAlbumArtImageView = (AsyncAlbumArtImageView)localView1.findViewById(2131296325); localViewHolder.icon = localAsyncAlbumArtImageView; PlayingIndicator localPlayingIndicator = (PlayingIndicator)localView1.findViewById(2131296415); localViewHolder.play_indicator = localPlayingIndicator; CharArrayBuffer localCharArrayBuffer = new CharArrayBuffer(100); localViewHolder.titleBuffer = localCharArrayBuffer; StatefulShadowTextView localStatefulShadowTextView3 = (StatefulShadowTextView)localView1.findViewById(2131296545); localViewHolder.year = localStatefulShadowTextView3; StatefulShadowTextView localStatefulShadowTextView4 = (StatefulShadowTextView)localView1.findViewById(2131296399); localViewHolder.duration = localStatefulShadowTextView4; StatefulShadowTextView localStatefulShadowTextView5 = (StatefulShadowTextView)localView1.findViewById(2131296401); localViewHolder.album = localStatefulShadowTextView5; StatefulShadowTextView localStatefulShadowTextView6 = (StatefulShadowTextView)localView1.findViewById(2131296400); localViewHolder.artist = localStatefulShadowTextView6; if (localViewHolder.artist == null) { StatefulShadowTextView localStatefulShadowTextView7 = (StatefulShadowTextView)localView1.findViewById(2131296348); localViewHolder.artist = localStatefulShadowTextView7; } localView1.setTag(localViewHolder); localViewHolder.contextMenu.setTag(localViewHolder); return localView1; }
@Override public View getView(final int position, View view, ViewGroup parent) { final ViewHolder holder; if (view == null) { view = mInflater.inflate(R.layout.flirt_buzz_single, null); holder = new ViewHolder(); holder.title = (TextView) view.findViewById(R.id.buzz_text1); holder.content = (TextView) view.findViewById(R.id.buzz_Ctext); holder.time_dis = (TextView) view.findViewById(R.id.buzz_time_dis); holder.userPic = (ImageView) view.findViewById(R.id.buzz_userPic); holder.contentPic = (ImageView) view.findViewById(R.id.buzz_pic); holder.wait = (ProgressBar) view.findViewById(R.id.buzz_wait); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } holder.title.setText(data.get(position)[1]); // 顯示文字說明 if (data.get(position)[3].equals("text")) { holder.content.setText(data.get(position)[2]); holder.contentPic.setImageBitmap(null); } else if (data.get(position)[3].equals("photo")) { holder.content.setText("上傳了一張圖片"); if (ImgCache.IsCache(data.get(position)[2]) == false) { ImgCache.LoadUrlPic(data.get(position)[2], h); } else if (ImgCache.IsDownLoadFine(data.get(position)[2]) == true) { // 如果已經下載完成,就顯示圖片並把ProgressBar隱藏 Bitmap Bmp = ImgCache.getImg(data.get(position)[2]); Bmp = Bitmap.createScaledBitmap( Bmp, 128, (int) (Bmp.getHeight() * 128 / Bmp.getWidth()), true); holder.contentPic.setImageBitmap(Bmp); } else { // 這裡是下載中,什麼事都不用做 } } holder.time_dis.setText(data.get(position)[4]); holder.userPic.setVisibility(View.INVISIBLE); holder.wait.setVisibility(View.VISIBLE); if (ImgCache.IsCache(data.get(position)[0]) == false) { // 如果圖片沒有暫存 ImgCache.LoadUrlPic(data.get(position)[0], h); } else if (ImgCache.IsDownLoadFine(data.get(position)[0]) == true) { // 如果已經下載完成,就顯示圖片並把ProgressBar隱藏 Bitmap Bmp = ImgCache.getImg(data.get(position)[0]); Bmp = Bitmap.createScaledBitmap(Bmp, 64, 64, true); holder.userPic.setImageBitmap(Bmp); holder.wait.setVisibility(View.GONE); holder.userPic.setVisibility(View.VISIBLE); } else { // 這裡是下載中,什麼事都不用做 } return view; }