-1

如何像这样在 ExpandListView 中向子列表添加标题

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

急需任何帮助,不胜感激

4

1 回答 1

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
}

希望这有帮助。

于 2013-08-22T10:49:31.843 回答