android开发中的ExpandableListView的adapter里的getview是干啥的
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.main_menu_list_child, null);
        holder = new ViewHolder();
        holder.mChildIcon = (ImageView) convertView.findViewById(R.id.desktop_list_child_icon);
        holder.mChildName = (TextView) convertView.findViewById(R.id.desktop_list_child_name);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    AbMenuItem m = mChilds.get(groupPosition).get(childPosition);
    holder.mChildIcon.setImageResource(m.getIconId());
    holder.mChildName.setText(m.getText());
    return convertView;
}

convertView和holder是什么?

1个回答

列表在绘制时会调用getView(), 拿到item的view也就是contentview, holder相当于保存item的子view的容器, 可以复用view

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问