Progressbar does not change color

Asked

Viewed 2,523 times

0

I have this problem of changing colors.

Code:

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

Appears to have changed color, but at runtime does not change.

3 answers

1

  • Dude, for me here did not appear this getIndeterminateDrawablw option

  • getProgressDrawable(), in your case!

1

Change the style of your Progressbar and add om 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>

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 out for me

Browser other questions tagged

You are not signed in. Login or sign up in order to post.