如何在弹出AlertDialog中添加ListView,并实现Item点击响应?如何动态跟新里面ListView?
详细描述:在屏幕上点击一个Button,弹出一个Dialog,里面显示ListView,并实现Item点击响应。并且里面item可以动态跟新。请问大神怎么实现呢?...
详细描述:在屏幕上点击一个Button,弹出一个Dialog,里面显示ListView,并实现Item点击响应。并且里面item可以动态跟新。请问大神怎么实现呢?
展开
1个回答
展开全部
您好,调用dialog函数就行了:this.dialog();
dialog函数如下:
private void dialog() {
// TODO Auto-generated method stub
AlertDialog.Builder builder = new Builder(PeopleActivity.this);
builder.setMessage("确认删除吗?");
builder.setTitle("提示");
builder.setPositiveButton("确认", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
builder.setNegativeButton("取消", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.create().show();
}
dialog函数如下:
private void dialog() {
// TODO Auto-generated method stub
AlertDialog.Builder builder = new Builder(PeopleActivity.this);
builder.setMessage("确认删除吗?");
builder.setTitle("提示");
builder.setPositiveButton("确认", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
builder.setNegativeButton("取消", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.create().show();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询