方法如下
private void showInputDialog(){
final EditText inputServer = new EditText(PracticebanjiActivity.this);
AlertDialog.Builder builder = new AlertDialog.Builder(PracticebanjiActivity.this);
builder.setTitle("填写会议标题").setIcon(R.drawable.ic_dialog_info).setView(inputServer)
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String mMeetName = inputServer.getText().toString();
//do something...
}
});
builder.show();
}