是否可以更改进度对话框的消息或微调器位置?

Is it possible to alter progress dialog's message or spinner position?

我基本上想在进度对话框中的进度条(微调器)之前放置消息文本,以便看起来像小吃店。

可能有一些我目前没有想到的更简单的方法来执行此操作,但您可以重写 ProgressDialogonCreate() 方法和 fiddle以编程方式布局。例如:

ProgressDialog pd = new ProgressDialog(this) {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ProgressBar progress = (ProgressBar) findViewById(android.R.id.progress);
        LinearLayout bodyLayout = (LinearLayout) progress.getParent();
        TextView messageView = (TextView) bodyLayout.getChildAt(1);

        LinearLayout.LayoutParams llp =
            (LinearLayout.LayoutParams) messageView.getLayoutParams();
        llp.width = 0;
        llp.weight = 1;

        bodyLayout.removeAllViews();
        bodyLayout.addView(messageView, llp);
        bodyLayout.addView(progress);
    }
};

pd.setMessage("Testing...");
pd.show();

我快速浏览了源版本,我认为这应该适用于几乎所有版本。