private class CategoryAdapter extends BaseAdapter {
// 资源信息
private int[] logoResIds = new int[] { R.drawable.id_ssq, R.drawable.id_3d, R.drawable.id_qlc };
private int[] titleResIds = new int[] { R.string.is_hall_ssq_title, R.string.is_hall_3d_title, R.string.is_hall_qlc_title };
@Override
public int getCount() {
return size;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = View.inflate(context, R.layout.il_hall_lottery_item, null);//R.layout.il_hall_lottery_item list的资源文件
holder.logo = (ImageView) convertView.findViewById(R.id.ii_hall_lottery_logo);
holder.title = (TextView) convertView.findViewById(R.id.ii_hall_lottery_title);
holder.summary = (TextView) convertView.findViewById(R.id.ii_hall_lottery_summary);
holder.bet = (ImageView) convertView.findViewById(R.id.ii_hall_lottery_bet);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.logo.setImageResource(logoResIds[position]);
holder.title.setText(titleResIds[position]);
holder.summary.setTag(position);
// holder.bet.setOnClickListener(new OnClickListener() {
//
// @Override
// public void onClick(View v) {
// if (position == 0) {
// MiddleManager.getInstance().changeUI(PlaySSQ.class,ssqBundle);
//
// }
//
// }
// });
return convertView;
}
// 依据item的layout
class ViewHolder {
ImageView logo;
TextView title;
TextView summary;
ImageView bet;
}
}
08-31