Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the color of an indefinite ProgressBar?

Tags:

I have a progressbar with the following style: style="?android:attr/android:progressBarStyleSmall"

Sadly the bar is nearly white and in my case displayed on a white background. The progressbar is nearly invisible because of that.

How can I change the color of the progressbar? A darker grey would be great.

like image 714
Janusz Avatar asked Apr 28 '10 12:04

Janusz


People also ask

What is ProgressBar indeterminate?

Indeterminate mode is the default for progress bar and shows a cyclic animation without a specific amount of progress indicated. The following example shows an indeterminate progress bar: <ProgressBar android:id="@+id/indeterminateBar" android:layout_width="wrap_content" android:layout_height="wrap_content" />

How do I make my progress bar horizontal Android?

In Android, by default a progress bar will be displayed as a spinning wheel but If we want it to be displayed as a horizontal bar then we need to use style attribute as horizontal. It mainly use the “android. widget. ProgressBar” class.


1 Answers

progressBar.getIndeterminateDrawable().setColorFilter(             getResources().getColor(R.color.light_light_purple),             android.graphics.PorterDuff.Mode.SRC_IN); 

This code changes the default holo inderminate drawable color to your own color. Define your color code and replace R.color.light_light_purple to R.color.your_color_code.

like image 93
Vishal Pandey Avatar answered Oct 22 '22 00:10

Vishal Pandey