public View getView(int position, View convertView, ViewGroup parent) { final View v; if (convertView == null) { v = mInflater.inflate(R.layout.list_item_image_text_image, null); } else { v = convertView; } ActivityInfo ai = null; try { ai = mPackageManager.getActivityInfo( Intent.parseUri(mIntents.get(position), 0).resolveActivity(mPackageManager), 0); } catch (Exception e) { e.printStackTrace(); } IntentAdapter local = this; final ViewHolder vh; if (v.getTag() == null) { vh = new ViewHolder(local); } else { vh = (ViewHolder) v.getTag(); } vh.line1 = (TextView) v.findViewById(R.id.txt_1x1); vh.icon = (ImageView) v.findViewById(R.id.img_1x1); v.findViewById(R.id.img_indicator).setVisibility(View.GONE); vh.line1.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); vh.line1.setText( ai == null ? (mIntents.size() <= 1 && position == 0) ? getString(R.string.warning_none_set) : getString(R.string.warning_problem_shortcut) : ai.loadLabel(mPackageManager)); vh.icon.setImageDrawable(ai == null ? null : ai.loadIcon(mPackageManager)); vh.icon.setVisibility(ai == null ? View.GONE : View.VISIBLE); v.setTag(vh); return v; }
@SuppressWarnings("unchecked") @Override public View getConvertView(Node node, int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.item_tree_list, parent, false); viewHolder = new ViewHolder(); viewHolder.icon = (ImageView) convertView.findViewById(R.id.treenode_icon); viewHolder.label = (TextView) convertView.findViewById(R.id.treenode_label); viewHolder.user = (TextView) convertView.findViewById(R.id.treenode_user); viewHolder.head = (CircleImageView) convertView.findViewById(R.id.treenode_head); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (node.getIcon() == -1) { viewHolder.icon.setVisibility(View.INVISIBLE); } else { viewHolder.icon.setVisibility(View.VISIBLE); viewHolder.icon.setImageResource(node.getIcon()); } viewHolder.label.setText(node.getName()); ProjectVO vo = (ProjectVO) node.getData(); viewHolder.user.setText(vo.getCREATE_USER_NAME()); imageLoader.displayImage( String.format(URLConstants.URL_IMG, vo.getCREATE_USER_HEAD()), viewHolder.head, options); return convertView; }
@Override public View getView(int position, View itemView, ViewGroup parent) { View v = itemView; if (v == null) { LayoutInflater vi = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.grocery_list_item, null); ViewHolder vh = new ViewHolder(); vh.label = (TextView) v.findViewById(R.id.label); vh.icon = (ImageView) v.findViewById(R.id.icon); v.setTag(vh); } TextView label = ((ViewHolder) v.getTag()).label; Row row = getRow(position); JsonNode item = row.getValueAsNode(); JsonNode itemText = item.get("text"); if (itemText != null) { label.setText(itemText.getTextValue()); } else { label.setText(""); } ImageView icon = ((ViewHolder) v.getTag()).icon; JsonNode checkNode = item.get("check"); if (checkNode != null) { if (checkNode.getBooleanValue()) { icon.setImageResource(R.drawable.list_area___checkbox___checked); } else { icon.setImageResource(R.drawable.list_area___checkbox___unchecked); } } return v; }
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; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; /*if (convertView == null) {*/ if (iWidth == 1920 && iHeight == 1128) convertView = mInflater.inflate(R.layout.outlinebig, null); else if (iWidth == 1024 && iHeight == 720) convertView = mInflater.inflate(R.layout.outlinemid, null); else convertView = mInflater.inflate(R.layout.outlinesmall, null); holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.text); holder.icon = (ImageView) convertView.findViewById(R.id.icon); convertView.setTag(holder); /*} else { holder = (ViewHolder) convertView.getTag(); }*/ int level = mfilelist.get(position).getLevel(); holder.icon.setPadding( 25 * (level + 1), holder.icon.getPaddingTop(), 0, holder.icon.getPaddingBottom()); holder.text.setText(mfilelist.get(position).getOutlineTitle()); if (mfilelist.get(position).isMhasChild() && (mfilelist.get(position).isExpanded() == false)) { holder.icon.setImageBitmap(mIconCollapse); } else if (mfilelist.get(position).isMhasChild() && (mfilelist.get(position).isExpanded() == true)) { holder.icon.setImageBitmap(mIconExpand); } else if (!mfilelist.get(position).isMhasChild()) { holder.icon.setImageBitmap(mIconCollapse); holder.icon.setVisibility(View.INVISIBLE); } 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_icon_text, null); // Creates a ViewHolder and store references to the two // children // views we want to bind data to. holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.text); holder.icon = (ImageView) convertView.findViewById(R.id.icon); convertView.setTag(holder); } else { // Get the ViewHolder back to get fast access to the // TextView // and the ImageView. holder = (ViewHolder) convertView.getTag(); } Bitmap icon = strImg.get(itemsD.get(position).getCategory()); // Bind the data efficiently with the holder. holder.text.setText(itemsD.get(position).getTitle()); holder.icon.setImageBitmap(icon); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; View view; if (convertView == null) { view = mInflater.inflate(mViewId, null, false); holder = new ViewHolder(); holder.icon = (ImageView) view.findViewById(android.R.id.icon); holder.description = (TextView) view.findViewById(android.R.id.text1); view.setTag(holder); } else { view = convertView; holder = (ViewHolder) view.getTag(); } CountryCode e = mData.get(position); StringBuilder text = new StringBuilder(3) .append('+') .append(e.countryCode) .append(" (") .append(e.regionName) .append(')'); holder.description.setText(text); int flagId = getFlag(e.regionCode); if (flagId > 0) holder.icon.setImageResource(flagId); else holder.icon.setImageDrawable(null); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = inflater.inflate(R.layout.schedule_calendar_selection_item, null); viewHolder = new ViewHolder(); viewHolder.name = (TextView) convertView.findViewById(R.id.calendar_name_text); viewHolder.desc = (TextView) convertView.findViewById(R.id.calendar_desc_text); viewHolder.icon = (ImageView) convertView.findViewById(R.id.select_icon); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } Calendar365 item = getItem(position); viewHolder.name.setText(item.getTitle()); if ("google".equals(item.getDataDomain())) { viewHolder.desc.setText("谷歌日历"); } else { viewHolder.desc.setText("365日历"); } if (item.getId() == calendarID) { viewHolder.icon.setImageResource(R.drawable.schedule_calendar_selected); } else { viewHolder.icon.setImageResource(R.drawable.schedule_calendar_unselect); } return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(PhotoShareActivity.this) .inflate(R.layout.photoshare_activity_location_item, null); holder = new ViewHolder(); holder.icon = (ImageView) convertView.findViewById(R.id.photoshare_activity_location_item_icon); holder.name = (TextView) convertView.findViewById(R.id.photoshare_activity_location_item_name); holder.location = (TextView) convertView.findViewById(R.id.photoshare_activity_location_item_location); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } LocationResult result = mKXApplication.mMyLocationResults.get(position); if (mLocationPosition == position) { holder.icon.setVisibility(View.VISIBLE); } else { holder.icon.setVisibility(View.INVISIBLE); } holder.name.setText(result.getName()); holder.location.setText(result.getLocation()); 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) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.project_git_tree_item, parent, false); holder = new ViewHolder(); holder.name = (TextView) convertView.findViewById(R.id.name); holder.icon = (ImageView) convertView.findViewById(R.id.icon); holder.comment = (TextView) convertView.findViewById(R.id.comment); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } GitFileInfoObject data = mData.get(position); holder.name.setText(data.name); if (data.isTree()) holder.icon.setImageResource(R.drawable.ic_project_git_folder); else holder.icon.setImageResource(R.drawable.ic_project_git_file); holder.comment.setText( String.format( commentFormat, data.lastCommitter.name, Global.dayToNow(data.lastCommitDate))); /*if (position == mData.size() - 1) { loadMore(); }*/ 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; }
/** Overrides newView() to inflate the list item views. */ @Override public View newView(Context context, Cursor cursor, ViewGroup viewGroup) { // Inflates the list item layout. final View itemLayout = mInflater.inflate(R.layout.contact_list_item, viewGroup, false); // Creates a new ViewHolder in which to store handles to each view // resource. This // allows bindView() to retrieve stored references instead of // calling findViewById for // each instance of the layout. final ViewHolder holder = new ViewHolder(); holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1); holder.text2 = (TextView) itemLayout.findViewById(android.R.id.text2); holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon); holder.selectContact = (CheckBox) itemLayout.findViewById(android.R.id.checkbox); holder.selectContact.setFocusable(false); holder.selectContact.setClickable(false); holder.selectContact.setTag(tagForCheckBox); tagForCheckBox++; // Stores the resourceHolder instance in itemLayout. This makes // resourceHolder // available to bindView and other methods that receive a handle to // the item view. itemLayout.setTag(holder); // Returns the item layout view return itemLayout; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.file_row, null); holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.text); holder.icon = (ImageView) convertView.findViewById(R.id.icon); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } File f = new File(paths.get(position).toString()); if (items.get(position).toString().equals("b1")) { holder.text.setText("Back to root directory"); holder.icon.setImageBitmap(mIcon1); } else if (items.get(position).toString().equals("b2")) { holder.text.setText("Back to paranet directory"); holder.icon.setImageBitmap(mIcon2); } else { holder.text.setText(f.getName()); if (f.isDirectory()) { holder.icon.setImageBitmap(mIcon3); } else if (f.getName().endsWith("arff") || (f.getName().endsWith("model"))) { holder.icon.setImageBitmap(mIcon4); } } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub index = position; ViewHolder holder = null; JoinCheck info = (JoinCheck) mList.get(position).get(INFO); String icon = info.getTitle(); String result = info.getResult(); String id = info.getCaseid(); String time = info.getTime(); String atm = info.getAtm(); String state = info.getDisplayState(); if (convertView == null) { convertView = mInflater.inflate(R.layout.join_check_listview_item, null); holder = new ViewHolder(); holder.icon = (TextView) convertView.findViewById(R.id.join_check_item_text_icon); holder.id = (TextView) convertView.findViewById(R.id.join_check_item_text_id); holder.result = (TextView) convertView.findViewById(R.id.join_check_item_text_result); holder.atm = (TextView) convertView.findViewById(R.id.join_check_item_text_amt); holder.time = (TextView) convertView.findViewById(R.id.join_check_item_text_time); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.icon.setText(icon); setResultColor(state, result, holder.result); holder.id.setText(id); holder.time.setText(time); holder.atm.setText(atm); 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; }
public View newView(Context context, Cursor cursor, ViewGroup parent) { View view; final ViewHolder holder = new ViewHolder(); if (!mIsList) { view = mInflater.inflate(R.layout.application_boxed, parent, false); } else { view = mInflater.inflate(R.layout.application_list, parent, false); holder.description = (TextView) view.findViewById(R.id.description); holder.icon = (ImageView) view.findViewById(R.id.icon); } holder.name = (TextView) view.findViewById(R.id.name); holder.idIndex = cursor.getColumnIndexOrThrow(LiveFolders._ID); holder.nameIndex = cursor.getColumnIndexOrThrow(LiveFolders.NAME); holder.descriptionIndex = cursor.getColumnIndex(LiveFolders.DESCRIPTION); holder.intentIndex = cursor.getColumnIndex(LiveFolders.INTENT); holder.iconBitmapIndex = cursor.getColumnIndex(LiveFolders.ICON_BITMAP); holder.iconResourceIndex = cursor.getColumnIndex(LiveFolders.ICON_RESOURCE); holder.iconPackageIndex = cursor.getColumnIndex(LiveFolders.ICON_PACKAGE); view.setTag(holder); return view; }
@Override public View getView(final int position, View convertView, ViewGroup arg2) { // TODO Auto-generated method stub final ViewHolder holder; final FansData bean = listFans.get(position); if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.item_fans, null, false); holder.icon = (ImageView) convertView.findViewById(R.id.img_icon); holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name); holder.tv_qianming = (TextView) convertView.findViewById(R.id.tv_qianming); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } mImageLoader.displayImage(bean.user.avatar_small, holder.icon, mDefaultOptions); holder.tv_name.setText(bean.user.uname); holder.tv_qianming.setText(bean.user.intro); convertView.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intent = new Intent(FansListActivity.this, FriendInfoActivity.class); intent.putExtra("uid", bean.user.uid + ""); startActivity(intent); } }); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder holder; if (convertView == null) { convertView = inflater.inflate(R.layout.message_list_item, null); holder = new ViewHolder(); holder.icon = (ImageView) convertView.findViewById(R.id.recent_userhead); holder.name = (TextView) convertView.findViewById(R.id.recent_name); holder.date = (TextView) convertView.findViewById(R.id.recent_time); holder.msg = (TextView) convertView.findViewById(R.id.recent_msg); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final KFChatEntity entity = list.get(position); KFSLog.d("conv.id " + entity.getId() + " conv.name:" + entity.getName()); // 首先获取昵称,如果昵称未设置,则显示对方用户名 if (entity.isSend() == 1) // 自己发送的消息 { holder.name.setText("自己发送的消息"); // 设置自己的头像 updateVCardThread(KFSettingsManager.getSettingsManager(context).getUsername(), holder.icon); } else { // 收到对方的消息 String nickname = KFIMInterfaces.getOtherNickname(entity.getName()); if (nickname == null) { nickname = entity.getName(); } holder.name.setText("收到来自:" + nickname + "的消息"); // 设置对方的头像 updateVCardThread(entity.getName(), holder.icon); } holder.name.setTextColor(Color.BLACK); holder.date.setText(entity.getDate()); holder.msg.setText("消息ID:" + entity.getId() + " 消息内容:" + entity.getText()); convertView.setOnCreateContextMenuListener( new OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // TODO Auto-generated method stub Log.d(TAG, "setOnCreateContextMenuListener"); } }); return convertView; }
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View v = super.newView(context, cursor, parent); ViewHolder vh = new ViewHolder(); vh.line1 = (TextView) v.findViewById(R.id.line1); vh.line2 = (TextView) v.findViewById(R.id.line2); vh.play_indicator = (ImageView) v.findViewById(R.id.play_indicator); vh.icon = (ImageView) v.findViewById(R.id.icon); vh.duration = (TextView) v.findViewById(R.id.duration); v.setTag(vh); return v; }
@Override public View newView(Context context, Cursor cursor, ViewGroup viewGroup) { View itemLayout = inflater.inflate(R.layout.sample_contacts_activity_item, viewGroup, false); ViewHolder holder = new ViewHolder(); holder.text1 = (TextView) itemLayout.findViewById(android.R.id.text1); holder.icon = (QuickContactBadge) itemLayout.findViewById(android.R.id.icon); itemLayout.setTag(holder); return itemLayout; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { v = View.inflate(getContext(), R.layout.emojicon_item, null); ViewHolder holder = new ViewHolder(); holder.icon = (TextView) v.findViewById(R.id.emojicon_icon); v.setTag(holder); } Emojicon emoji = getItem(position); ViewHolder holder = (ViewHolder) v.getTag(); holder.icon.setText(emoji.getEmoji()); return v; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { view = mInflater.inflate(ResFinder.getLayout("emoji_item"), parent, false); ViewHolder holder = new ViewHolder(); holder.icon = (EmojiTextView) view; view.setTag(holder); } EmojiBean emoji = getItem(position); ViewHolder holder = (ViewHolder) view.getTag(); holder.icon.setText(emoji.getEmoji()); return view; }
/** * 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_icon_text, null); // Creates a ViewHolder and store references to the two children views // we want to bind data to. holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.text); holder.icon = (ImageView) convertView.findViewById(R.id.icon); holder.permission = (ImageView) convertView.findViewById(R.id.permission); holder.permissionText = (TextView) convertView.findViewById(R.id.TextViewPermission); convertView.setTag(holder); } else { // Get the ViewHolder back to get fast access to the TextView // and the ImageView. holder = (ViewHolder) convertView.getTag(); } // Bind the data efficiently with the holder. holder.text.setText(LABELS[position]); holder.icon.setImageBitmap(ICONS[position]); if (PERMISSIONS[position] == ConfigurationDatabase.PERMISSION_UNKNOWN) { PERMISSIONS[position] = PERMISSION_DEFAULT; } if (PERMISSIONS[position] == ConfigurationDatabase.PERMISSION_ALLOW) { holder.permission.setImageBitmap(mBitmapAllow); holder.permissionText.setText(PERMISSION_STRING_ALLOW); } else if (PERMISSIONS[position] == ConfigurationDatabase.PERMISSION_DISALLOW) { holder.permission.setImageBitmap(mBitmapDisallow); holder.permissionText.setText(PERMISSION_STRING_DISALLOW); } else if (PERMISSIONS[position] == ConfigurationDatabase.PERMISSION_ASK) { holder.permission.setImageBitmap(mBitmapAsk); holder.permissionText.setText(PERMISSION_STRING_ASK); } holder.icon.setImageBitmap(ICONS[position]); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.box_grid_item, null); ViewHolder viewHolder = new ViewHolder(); viewHolder.name = (TextView) convertView.findViewById(R.id.box_grid_name); viewHolder.icon = (ImageView) convertView.findViewById(R.id.box_grid_icon); convertView.setTag(viewHolder); } ViewHolder holder = (ViewHolder) convertView.getTag(); Box box = boxes.get(position); holder.icon.setImageBitmap( BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher)); holder.name.setText(box.getName()); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.row, null); viewHolder = new ViewHolder(); viewHolder.icon = (ImageView) convertView.findViewById(R.id.row_icon); viewHolder.title = (TextView) convertView.findViewById(R.id.row_title); convertView.setTag(viewHolder); } viewHolder = (ViewHolder) convertView.getTag(); viewHolder.icon.setImageResource(getItem(position).iconRes); viewHolder.title.setText(getItem(position).tag); return convertView; }
/* * (non-Javadoc) * * @see * android.support.v4.widget.CursorAdapter#newView(android.content.Context * , android.database.Cursor, android.view.ViewGroup) */ @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { LayoutInflater vi = getActivity().getLayoutInflater(); ViewHolder holder = new ViewHolder(); View view = vi.inflate(R.layout.list_row_channel, null); holder.v = (CheckableLinearLayout) view; holder.icon = (ImageView) view.findViewById(R.id.icon); holder.position = (TextView) view.findViewById(R.id.position); holder.channelName = (TextView) view.findViewById(R.id.title); holder.epgTime = (TextView) view.findViewById(R.id.epgTime); holder.progress = (ProgressBar) view.findViewById(R.id.progress); holder.epgTitle = (TextView) view.findViewById(R.id.epgTitle); holder.contextMenu = (ImageView) view.findViewById(R.id.contextMenu); holder.contextMenu.setOnClickListener(ChannelList.this); view.setTag(holder); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; ViewHolder viewHolder = null; if (rowView == null) { LayoutInflater inflate = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflate.inflate(R.layout.row_dashboard_alert, null); viewHolder = new ViewHolder(); viewHolder.avatar = (ImageView) rowView.findViewById(R.id.avatar); viewHolder.name = (TextView) rowView.findViewById(R.id.name); viewHolder.alert = (TextView) rowView.findViewById(R.id.alert); viewHolder.time = (RelativeTimeTextView) rowView.findViewById(R.id.time); viewHolder.icon = (ImageView) rowView.findViewById(R.id.icon); viewHolder.arrow = (ImageView) rowView.findViewById(R.id.arrow); rowView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } DashboardGiftItem item = mlst.get(position); if (item.getPhoto().length() > 0) { Picasso.with(mContext) .load(item.getPhoto()) .placeholder(R.drawable.avatar) .into(viewHolder.avatar); } else { viewHolder.avatar.setImageResource(R.drawable.avatar); } viewHolder.name.setText(item.getUsernameSend().toString()); viewHolder.alert.setText("Sent you a gift"); viewHolder.time.setReferenceTime(item.getTime()); viewHolder.icon.setImageResource(R.drawable.ic_gift); viewHolder.arrow.setImageResource(R.drawable.arrow_right); if (item.getStatus() == 0) { rowView.setBackgroundColor(Color.parseColor("#e3f4f8")); viewHolder.icon.setImageResource(R.drawable.gift_icon); viewHolder.name.setTextColor(Color.parseColor("#101010")); viewHolder.name.setTypeface(null, Typeface.BOLD); viewHolder.alert.setTypeface(null, Typeface.BOLD); } return rowView; }
@Override public View getView(int position, View convertView, ViewGroup container) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(mContext).inflate(R.layout.choose_griditem, container, false); holder.imageView = (RecyclingImageView) convertView.findViewById(R.id.imageView); holder.icon = (ImageView) convertView.findViewById(R.id.video_icon); holder.tvDur = (TextView) convertView.findViewById(R.id.chatting_length_iv); holder.tvSize = (TextView) convertView.findViewById(R.id.chatting_size_iv); holder.imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); holder.imageView.setLayoutParams(mImageViewLayoutParams); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } // Check the height matches our calculated column width if (holder.imageView.getLayoutParams().height != mItemHeight) { holder.imageView.setLayoutParams(mImageViewLayoutParams); } // Finally load the image asynchronously into the ImageView, this // also takes care of // setting a placeholder image while the background thread runs String st1 = getResources().getString(R.string.Video_footage); if (position == 0) { holder.icon.setVisibility(View.GONE); holder.tvDur.setVisibility(View.GONE); holder.tvSize.setText(st1); holder.imageView.setImageResource(R.drawable.actionbar_camera_icon); } else { holder.icon.setVisibility(View.VISIBLE); VideoEntity entty = mList.get(position - 1); holder.tvDur.setVisibility(View.VISIBLE); holder.tvDur.setText(DateUtils.toTime(entty.duration)); holder.tvSize.setText(TextFormater.getDataSize(entty.size)); holder.imageView.setImageResource(R.drawable.empty_photo); mImageResizer.loadImage(entty.filePath, holder.imageView); } return convertView; // END_INCLUDE(load_gridview_item) }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder holder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.ruyihelper_listview_icon_item, null); holder = new ViewHolder(); holder.title = (TextView) convertView.findViewById(R.id.ruyihelper_icon_text); holder.icon = (ImageView) convertView.findViewById(R.id.ruyihelper_iicon); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.title.setText(list.get(position).get("title").toString()); convertView.setId(Integer.parseInt(list.get(position).get("id").toString())); holder.icon.setBackgroundResource(R.drawable.xiangyou); return convertView; }