80,337
社区成员
发帖
与我相关
我的任务
分享
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null){
LayoutInflater inflater = (LayoutInflater)xxx.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.main, null);
}
//Do your things
return convertView;
}
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null){
convertView = new MyView();
}
//Do your things
return convertView;
}
ViewHolder holder;
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.text);
holder.icon = (ImageView) convertView.findViewById(R.id.icon);
convertView.setTag(holder);
static class ViewHolder {
TextView text;
ImageView icon;
}