ProgressBar does not change color

0

I have this problem of changing color.

Code:

    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:indeterminateTint="#00bfff"/>

It appears that it has changed color, but at the time of execution it does not change.

    
asked by anonymous 04.09.2015 / 16:15

3 answers

1

Have you tried using a ColorFilter in your code to 'paint' your progressBar?

(ProgressBar) findViewById(R.id.progressBar))
    .getIndeterminateDrawable()
    .setColorFilter(Color.RED, Mode.SRC_IN);

You can take a look at the class in, link

    
09.09.2015 / 08:09
1

Change the style of your ProgressBar and add the Drawable android:progressDrawable as the example below and create a Drawable file as in the example.

<ProgressBar
  style="@android:style/Widget.ProgressBar.Horizontal"
  android:progressDrawable="@drawable/blueprogressbar"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"/>

Drawable layout file. Code below should be in the Layout folder with the name blueprogressbar.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
    <shape>
        <corners android:radius="5dip" />
        <gradient
                android:startColor="#ff9d9e9d"
                android:centerColor="#ff5a5d5a"
                android:centerY="0.75"
                android:endColor="#ff747674"
                android:angle="270"
        />
    </shape>
</item>

<item android:id="@android:id/secondaryProgress">
    <clip>
        <shape>
            <corners android:radius="5dip" />
            <gradient
                    android:startColor="#80ffd300"
                    android:centerColor="#80ffb600"
                    android:centerY="0.75"
                    android:endColor="#a0ffcb00"
                    android:angle="270"
            />
        </shape>
    </clip>
</item>
<item
    android:id="@android:id/progress"
>
    <clip>
        <shape>
            <corners
                android:radius="5dip" />
            <gradient
                android:startColor="#338FFF"
                android:endColor="#003180"
                android:angle="270" />
        </shape>
    </clip>
</item>

</layer-list>
    
11.09.2015 / 21:15
0
<RelativeLayout
    android:id="@+id/splach_screen"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/sfrango"
    android:visibility="visible"
    android:progressDrawable="@drawable/progress"
    >

    <ProgressBar
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="200dp"
        android:layout_height="10dp"
        android:id="@+id/webViewProgress"
        android:indeterminateOnly="true"
        android:progressDrawable="@drawable/progress"
        android:indeterminateTint="#e29700"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />


</RelativeLayout>

So it worked for me

    
24.08.2016 / 16:45