Color Spinner ProgressDialog - Android

1

How do I change the default color of ProgressDialog (Spinner) in android? Here is the code I'm using:

ProgressDialog progress = new ProgressDialog(this);
        progress.setTitle("Título);
        progress.setMessage("Mensagem");
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.show();
    
asked by anonymous 29.03.2016 / 20:01

2 answers

3

I solved the problem with the following code:

I added a layout for my ProgressDialog

progress = new ProgressDialog(this, R.style.styleProgressDialog);

And I customized the colors in my style as follows:

<style name="styleProgressDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
    <item name="android:tint">@color/colorPrimary</item>
    <item name="android:textSize">12dp</item>
</style>
    
29.03.2016 / 21:48
0

You need to change the progressTint property to the color you want.

You can do this directly in the xml of your layout or via code:

progress.setProgressTintList(ColorStateList.valueOf(Color.RED));
    
29.03.2016 / 20:46