在expandableListView android中添加动态子视图

时间:2013-12-12 12:49:00

标签: java android

我有一个扩展BaseExpandableListAdapter的ExpandableListView。我想动态添加ExpandableListView的子项(对于每个子布局可能不同)。请帮助我。

1 个答案:

答案 0 :(得分:0)

在您的Activity中实现OnChildClickListener并实现此方法..

@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {

   //Add new chid data in your list (ex ArrayLis or Array whatever you use)
   adapter.notifyDataSetChanged() // BaseExpandableListAdapter's adapter...


  return true;
}

这对你有用吗?