I am using a circular ProgressBar
in my Activty.My Problem is this it is not visible properly on my page because my page\'s BG color is same as ProgressBar .So
This is an old question, but using theme is not mentioned here. If your default theme is using AppCompat
, your ProgressBar
's color will be colorAccent
you have defined.
Changing colorAccent
will also change your ProgressBar
's color, but these changes also reflects at multiple places. So, if you want a different color just for a specific ProgressBar
you can do that by applying theme to that ProgressBar
alone:
Extend your default theme and override colorAccent
And in ProgressBar
add the android:theme
attribute:
android:theme="@style/AppTheme.WhiteAccent"
So it will look something like this:
So you are just changing a colorAccent
for your particular ProgressBar
.
Note: Using style
will not work. You need to use android:theme
only.
You can find more use of theme here: https://plus.google.com/u/0/+AndroidDevelopers/posts/JXHKyhsWHAH
Edit
Here is the code for changing the color of ProgressBar by programatically.
ProgressBar progressBar = (ProgressBar) findViewById(R.id.pb_listProgressBar);
int colorCodeDark = Color.parseColor("#F44336");
progressBar.setIndeterminateTintList(ColorStateList.valueOf(colorCodeDark));