如何将图像添加到父级的可扩展列表视图中?

时间:2017-05-22 11:05:07

标签: android image expandablelistview

如何在可扩展列表视图中使用imageheader?

public View getGroupView(int groupPosition, boolean isExpanded,
        View convertView, ViewGroup parent) {



    return convertView;
}

1 个答案:

答案 0 :(得分:0)

仍然不确定什么是imagehader,但要在expandablelistview标头中设置图像,你应该这样做:

@Override
public View getGroupView(int listPosition, boolean isExpanded,
                         View convertView, ViewGroup parent) {

    if (convertView == null) {
        LayoutInflater layoutInflater = (LayoutInflater) this.context.
                getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = layoutInflater.inflate(R.layout.your_layout, null);
    }


    ImageView imageheader = (ImageView) convertView.findViewById(R.id.imageheader);
    return convertView;
}