Android ExpandableListView / ExpandableListActivity 使用及数据更新
2010-08-21 06:33:00 来源:WEB开发网addInfo("kandyli",new String[]{"12345"});
}
public void addInfo(String p,String[] c){
group.add(p);
List
for(int i=0;i
item.add(c[i]);
}
child.add(item);
}
public void initialData(){
group = new ArrayList
child = new ArrayList
addInfo("griffinshi", new String[]{"13776117119","man","Jiangsu"});
addInfo("lancewu",new String[]{"1321134","man","Taiwan"});
addInfo("kandyli",new String[]{"12345"});
}
public void addInfo(String p,String[] c){
group.add(p);
List
for(int i=0;i
item.add(c[i]);
}
child.add(item);
}
3. 定义BaseExpandableListAdapter 并与List
Java代码
public class InfoDetailsAdapter extends BaseExpandableListAdapter {
Activity activity;
public InfoDetailsAdapter(Activity a){
activity = a;
}
//child method stub
@Override
public Object getChild(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return child.get(groupPosition).get(childPosition);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return childPosition;
}
@Override
public int getChildrenCount(int groupPosition) {
// TODO Auto-generated method stub
return child.get(groupPosition).size();
Tags:Android ExpandableListView ExpandableListActivity
编辑录入:coldstar [复制链接] [打 印]更多精彩
赞助商链接