如何在AlertDialog中设置为CENTER标题?

Mr_*_*nts 7 java android android-alertdialog

可能重复:
Android上的自定义对话框:如何将其标题居中?

我有代码:

     return new AlertDialog.Builder(getActivity())

            .setTitle("Warning!")
            .setMessage("message!")
            .setPositiveButton("yes ",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
Run Code Online (Sandbox Code Playgroud)

等...如何将.setTitle("警告!")设置为CENTER?

Mik*_* L. 3

您无法将标题置于默认警报对话框的中心。

您将需要创建一个自定义对话框以使标题居中。

这里的答案描述了如何做到这一点。