我有一个非常简单的问题。在我的包含可扩展列表视图的对话框中,当我单击一个孩子时,我想要执行一些操作并返回到活动。我的点击事件setOnChildClickListener()
和setOnGroupClickListener()
都在工作,但我的alertdialog没有关闭。我想关闭我的alertdialog,单击列表中的小孩点击并返回到我的活动。任何人都可以帮忙吗?Expandable列表视图Child click监听器
代码:
final AlertDialog.Builder builder = new AlertDialog.Builder(
TestActivity.this);
ExpandableListView dialogExpandableListView = new ExpandableListView(
this);
dialogExpandableListView
.setAdapter(new EfficienctExpandableAdapter(
this));
dialogExpandableListView
.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView arg0,
View arg1, int arg2, int arg3, long arg4) {
// TODO Auto-generated method stub
Log.d("skt", "clicked parent " + arg2 + " child "
+ arg3);
return false;
}
});
dialogExpandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Log.d("skt", "group click --- clicked parent " + arg2);
return false;
}
});
builder.setView(dialogExpandableListView);
builder.create();
builder.show();
后一些代码..这将有助于寻找你做什么 – GoCrazy 2012-08-02 12:06:14
@Vinoth代码贴 – SKT 2012-08-02 12:19:18