我创建了充气布局,并制作了我想在单击按钮时关闭对话框的按钮。
final AlertDialog.Builder alert = new AlertDialog.Builder(this);
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.subtractalert,null);
按钮代码
final Button delete = (Button) textEntryView.findViewById(R.id.deleteButton);
delete.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// I want to close the dialog at here
}
});
感谢所有回答,如果您想要更多代码,请告诉我:)