WEB开发网
开发学院手机开发Android 开发 Android ExpandableListView / ExpandableListAct... 阅读

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.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;

上一页  8 9 10 11 12 13 14  下一页
赞助商链接