android 弹出带输入框的对话框

 private void inputTitleDialog() {

        final EditText inputServer = new EditText(this);
        inputServer.setFocusable(true);

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(getString(R.string.record_save_dialog_title)).setIcon(
                R.drawable.dialog_logo).setView(inputServer).setNegativeButton(
                getString(R.string.record_save_dialog_cancel), null);
        builder.setPositiveButton(getString(R.string.record_save_dialog_ok),
                new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {
                        String inputName = inputServer.getText().toString();
                    }
                });
        builder.show();
    }

你可能感兴趣的:(android)