How to add text view on the same line as positive and negative buttons in dialog fragment

271 views Asked by At

I have created my dialog fragment as follows:

public Dialog onCreateDialog(Bundle savedInstanceState) {

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.MessageDialogStyle);
    final View layout = getActivity().getLayoutInflater().inflate(R.layout.dialog_layout, null);
    builder.setView(layout)
            .setTitle(R.string.dialog_text)
            .setPositiveButton(R.string.dialog_positive, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    EditText text = (EditText) layout.findViewById(R.id.message);
                    mListener.onDialogSave(text.getText().toString());
                }
            })
            .setNegativeButton(R.string.dialog_negative, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    MessageDialogFragment.this.getDialog().cancel();
                }
            });

    return builder.create();
    }

As you can see I have inflated a layout for the body of the dialog and set the positive and negative buttons through the builder. Therefore the layout that I have inflated stops before the buttons. Is there any way to create a textview on the same line as the positive and negative buttons but on the left hand side rather than the right? Thanks

0

There are 0 answers