更改“不确定进行中”对话框的颜色

时间:2017-03-21 05:11:38

标签: java android android-studio progressdialog

ProgressDialog dialog = ProgressDialog.show(ctx,null,null);
                dialog.getWindow().setGravity(Gravity.CENTER);
                dialog.setContentView(new ProgressBar(ctx));
                dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);

我需要更改加载圈的颜色

1 个答案:

答案 0 :(得分:0)

<style name="DialogStyle" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorPrimary">@color/YOUR_COLOR</item>
</style>

并设置为对话框:

ProgressDialog progressDialog = new ProgressDialog(MainActivity.this, R.style.DialogStyle);