@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.sim_adp_layout, null); holder.listImage = (ImageView) convertView.findViewById(R.id.listImage); holder.name = (TextView) convertView.findViewById(R.id.name); holder.info = (TextView) convertView.findViewById(R.id.info); holder.btnList = (Button) convertView.findViewById(R.id.btnList); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.listImage.setBackgroundResource((Integer) mData.get(position).get("listImage")); holder.name.setText((String) mData.get(position).get("name")); holder.info.setText((String) mData.get(position).get("info")); holder.btnList.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { showInfo(); } }); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; final int temp_position = position; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.activity_selectedphoto, null); holder.img = (ImageView) convertView.findViewById(R.id.img); holder.title = (TextView) convertView.findViewById(R.id.title); holder.info = (TextView) convertView.findViewById(R.id.info); holder.viewBtn = (ImageButton) convertView.findViewById(R.id.view_btn); // 让按钮失去焦点,让ListView能够获得点击响应 holder.viewBtn.setFocusableInTouchMode(false); holder.viewBtn.setFocusable(false); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final View eachView = convertView; ImageLoader imageLoader = ImageLoader.getInstance(); // 第一个参数是uri,第二个参数是显示图片的imageView,第三个参数是刚刚构造的图片显示选项,第四个参数是加载的回调方法,displayImage有很多重载方法这中介其中一种; imageLoader.displayImage( (String) mData.get(position).get("img"), holder.img, options, animateFirstListener); holder.title.setText((String) mData.get(position).get("title")); holder.info.setText((String) mData.get(position).get("info")); holder.viewBtn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { showInfo( (String) mData.get(temp_position).get("title"), ((TextView) eachView.findViewById(R.id.info)).getText().toString(), (TextView) eachView.findViewById(R.id.info), temp_position); } }); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.list_contacts, null); holder.img = (RoundImageView) convertView.findViewById(R.id.img); holder.title = (TextView) convertView.findViewById(R.id.name); holder.info = (TextView) convertView.findViewById(R.id.num); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } // holder.img.setBackgroundResource((Integer) mData.get(position).get("img")); holder.img.setImageBitmap((Bitmap) mData.get(position).get("img")); holder.title.setText((String) mData.get(position).get("name")); holder.info.setText((String) mData.get(position).get("num")); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder vh = null; if (convertView == null) { vh = new ViewHolder(); convertView = inflate(R.layout.common_chat_gift_smile_grid_item); vh.gift = (ImageView) convertView.findViewById(R.id.chat_gift); vh.name = (TextView) convertView.findViewById(R.id.chat_gift_name); vh.price = (TextView) convertView.findViewById(R.id.chat_gift_price); vh.info = (TextView) convertView.findViewById(R.id.chat_gift_info); vh.mask = convertView.findViewById(R.id.mask_view); vh.mask.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) {} }); convertView.setTag(vh); } else { vh = (ViewHolder) convertView.getTag(); } GiftItem item = getItem(position); ModuleMgr.getSmileMgr().reqImage(vh.gift, item.getImg()); vh.name.setText(item.getName()); vh.price.setText("" + item.getPrice() + "钻石"); vh.info.setText(item.getInfo()); if (ModuleMgr.getSmileMgr().getGiftLevel(chatAdapter.getLWhisperId()) < item.getLevel()) { vh.mask.setVisibility(View.VISIBLE); } else { vh.mask.setVisibility(View.GONE); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { // inflate the layout LayoutInflater inflater = LayoutInflater.from(getContext()); convertView = inflater.inflate(layoutResourceId, parent, false); // well set up the ViewHolder viewHolder = new ViewHolder(); viewHolder.title = (TextView) convertView.findViewById(R.id.title); viewHolder.subtitle = (TextView) convertView.findViewById(R.id.subtitle); viewHolder.info = (TextView) convertView.findViewById(R.id.info); viewHolder.avatar = (ImageView) convertView.findViewById(R.id.imageView); // store the holder with the view. convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.position = position; Matter matter = getItem(position); if (matter != null && viewHolder != null) { setTitle(viewHolder.title, matter); setSubtitle(viewHolder.subtitle, matter); setInfo(viewHolder.info, matter); setImage(viewHolder, matter, position); } return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View hView = convertView; mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (convertView == null) { holder = new ViewHolder(); hView = mInflater.inflate(R.layout.listrow, null); holder.id = (TextView) hView.findViewById(R.id.textView_id); holder.info = (TextView) hView.findViewById(R.id.textView_info); // holder.info = (TextView) hView.findViewById(R.id.info); hView.setTag(holder); } else { holder = (ViewHolder) hView.getTag(); } holder.id.setText(position + ": " + arrayList.get(position)); holder.info.setText(frndarrayList1.get(position)); // ViewHolder holder = (ViewHolder) hView.getTag(); hView.setTag(holder); return hView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { int[] aResId = {R.drawable.grey, R.drawable.red}; int START_ID; final int index = position; START_ID = LIUCB_START_ID + position * 3; String team1 = (String) mList.get(position).get("TEAM1"); String team2 = (String) mList.get(position).get("TEAM2"); String scores1 = (String) mList.get(position).get("SCORES1"); String scores2 = (String) mList.get(position).get("SCORES2"); ViewHolder holder = null; convertView = mInflater.inflate(R.layout.buy_football_sixhalf_listitem, null); holder = new ViewHolder(); holder.lie = ((TextView) convertView.findViewById(R.id.liuchangban_lienum)); holder.teamnamerank1 = (TextView) convertView.findViewById(R.id.liuchangban_teamrank1); holder.teamnamerank2 = (TextView) convertView.findViewById(R.id.liuchangban_teamrank2); holder.layout = (LinearLayout) convertView.findViewById(R.id.liuchangban_ball_layout); holder.info = (ImageView) convertView.findViewById(R.id.liuchangban_fenxi); convertView.setTag(holder); LinearLayout itemmainlinear = (LinearLayout) convertView.findViewById(R.id.sixhalforgoalsitem); setFootballListItemBackground(itemmainlinear, position); int liuCBBallFieldWidth = iScreenWidth * 2 / 5; BallTable liucbRow1 = makeBallTable( (LinearLayout) convertView, R.id.liuchangban_ball_1, liuCBBallFieldWidth, aResId, START_ID); ballTables.add(liucbRow1); Vector<OneBallView> BallViews1 = liucbRow1.getBallViews(); for (int i = 0; i < BallViews1.size(); i++) { final OneBallView ball = BallViews1.get(i); ball.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // ball.startAnim(); ball.changeBallColor(); changeTextSumMoney(getZhuShu()); } }); } BallTable liucbRow2 = makeBallTable( (LinearLayout) convertView, R.id.liuchangban_ball_2, liuCBBallFieldWidth, aResId, START_ID); ballTables.add(liucbRow2); Vector<OneBallView> BallViews2 = liucbRow2.getBallViews(); for (int i = 0; i < BallViews2.size(); i++) { final OneBallView ball2 = BallViews2.get(i); ball2.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { ball2.startAnim(); ball2.changeBallColor(); changeTextSumMoney(getZhuShu()); } }); } holder.lie.setText((String.valueOf(position + 1))); if (scores1 == null || scores2.equals(null)) { holder.teamnamerank1.setText(team1); holder.teamnamerank2.setText(team2); } else { holder.teamnamerank1.setText(team1 + "[" + scores1 + "]"); holder.teamnamerank2.setText(team2 + "[" + scores2 + "]"); } holder.info.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { getInfo(index); } }); return convertView; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { int[] aResId = {R.drawable.grey, R.drawable.red}; int START_ID; final int index = position; START_ID = SHENGFC_START_ID + position * 3; String team1 = (String) mList.get(position).get("TEAM1"); String team2 = (String) mList.get(position).get("TEAM2"); String scores1 = (String) mList.get(position).get("SCORES1"); String scores2 = (String) mList.get(position).get("SCORES2"); ViewHolder holder = null; holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.buy_football_sforchosenine_listitem, parent, false); holder.lie = ((TextView) convertView.findViewById(R.id.lienum)); holder.teamname = (TextView) convertView.findViewById(R.id.teamname); holder.teamrank = (TextView) convertView.findViewById(R.id.teamrank); holder.layout = (LinearLayout) convertView.findViewById(R.id.shengfucai_layout); holder.info = (ImageView) convertView.findViewById(R.id.fenxi); LinearLayout linearSF = (LinearLayout) convertView.findViewById(R.id.sforchoosenine_item); setFootballListItemBackground(linearSF, position); int aFieldWidth = iScreenWidth / 3; BallTable shengfcRow = null; shengfcRow = makeBallTable(holder.layout, R.id.shengfucai_ball, aResId, START_ID); if (ballTables.size() < mList.size()) { ballTables.add(shengfcRow); } Vector<OneBallView> BallViews = shengfcRow.getBallViews(); for (int i = 0; i < BallViews.size(); i++) { final OneBallView ball = BallViews.get(i); ball.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // ball.startAnim(); ball.changeBallColor(); changeTextSumMoney(getZhuShu()); } }); } if (position < 9) { holder.lie.setText((String.valueOf(position + 1)) + " "); } else { holder.lie.setText((String.valueOf(position + 1))); } if (team1.length() == 2) { team1 = " " + team1; } if (team2.length() == 2) { team2 += " "; } holder.teamname.setText(team1 + "VS" + team2); try { if (scores1 != null) { holder.teamrank.setText(" " + scores1 + " " + scores2); } } catch (Exception e) { } holder.info.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { getInfo(index); } }); return convertView; }