我创建了我的对话框片段如下:
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();
}
正如您所看到的,我已经为对话框的主体夸大了布局,并通过构建器设置了正负按钮。因此,我膨胀的布局在按钮之前停止。有没有办法在正负按钮的同一行创建文本视图,但在左侧而不是右侧?感谢