Dioo B
Dioo B

Reputation: 82

How to change circle color in progress dialog? (no style.xml, only themes.xml)

Hellow, i want to ask something. How can i change this color of circle from Progress Dialog? My project don't have style.xml, it has themes.xml and the dark version of themes.xml so no colorAccent, even so i added colorAccent in themes.xml anyway. I also already changed my secondary and primary color that indicate the same color of this circle but it still didn't change.

enter image description here

Here is how i make my progress dialog after init:

mLoginProgress.setTitle(resources.getString(R.string.loginloadingtitle));
mLoginProgress.setMessage(resources.getString(R.string.loginloadingmessage));
mLoginProgress.setCanceledOnTouchOutside(false);
mLoginProgress.show();

Upvotes: 1

Views: 113

Answers (2)

Nitish
Nitish

Reputation: 3411

You can create your own ProgessBar and set it in ProgressDialog using setIndeterminateDrawable.

ProgressDialog mLoginProgress = new ProgressDialog(this);
mLoginProgress.setTitle(resources.getString(R.string.loginloadingtitle));
mLoginProgress.setMessage(resources.getString(R.string.loginloadingmessage));
mLoginProgress.setCanceledOnTouchOutside(false);
Drawable drawable = new ProgressBar(this).getIndeterminateDrawable().mutate();
drawable.setColorFilter(ContextCompat.getColor(this, R.color.colorPrimaryDark),
            PorterDuff.Mode.SRC_IN);
mLoginProgress.setIndeterminateDrawable(drawable);

mLoginProgress.show();

Upvotes: 1

Abdullah Z Khan
Abdullah Z Khan

Reputation: 1286

Try with ProgressDialog(Context context, int theme) with the theme where you added colorAccent

Upvotes: 0

Related Questions