如何在ExpandListVie中将标题添加到子列表

时间:2013-08-22 09:59:04

标签: android

如何将标题添加到ExpandListView中的子列表,如下所示

AvailableTasks       =============     Parent
TaskNo   TaskName    Status
-----------------------------
  1        read      progress      |
-----------------------------      |
  2        listen    pending       |   Childs
-----------------------------      |
  3       walking   started        |
-----------------------------      |

迫切需要任何帮助,表示赞赏

1 个答案:

答案 0 :(得分:0)

你的getChildrenCount中的

你的小组标题增加到1,如:

@Override
public int getChildrenCount(int groupPosition) {
    return "your children group count" + 1;
}

并在getChildView中检查组的第一个子组并返回组的标题,如

@Override
public View getChildView(int groupPosition, final int childPosition,
        boolean isLastChild, View convertView, ViewGroup parent) {
    if(childPosition == 0){
         return "your header of group view";
    }
    // your original code here, note that, the childPosition is increased to 1
}

希望得到这个帮助。