Android ExpandableListView / ExpandableListActivity 使用及数据更新
2010-08-21 06:33:00 来源:WEB开发网dialogDelete.dismiss();
}
});
}
public void createDialogDelete(){
viewDelete = this.getLayoutInflater().inflate(R.layout.delete, null);
dialogDelete = new Dialog(this);
dialogDelete.setContentView(viewDelete);
dialogDelete.setTitle("删除指定成员");
delete_id = (EditText)viewDelete.findViewById(R.id.delete_id);
delete_ok = (Button)viewDelete.findViewById(R.id.delete_ok);
delete_no = (Button)viewDelete.findViewById(R.id.delete_no);
delete_ok.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
String id = delete_id.getText().toString();
if(! id.equals("")){
int i = Integer.parseInt(id);
group.remove(i);
child.remove(i);
dialogDelete.dismiss();
mAdapter.notifyDataSetChanged();
}
}
});
delete_no.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
dialogDelete.dismiss();
}
});
}
* 运行截图:
最后 说一下ExpandableListView的回调函数 用于监听那个id 被expand
Java代码
expandList.setOnGroupClickListener(new OnGroupClickListener(){
@Override
public boolean onGroupClick(ExpandableListView arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
Toast.makeText(activity,"[Group Click]:"+arg2,Toast.LENGTH_LONG).show();
return false;
Tags:Android ExpandableListView ExpandableListActivity
编辑录入:coldstar [复制链接] [打 印]更多精彩
赞助商链接