1

So, after reading numerous questions on this, I am still stuck here, here's what I want to do:

  1. Change the color of the shape (id="myShape") from Java.
  2. Picking ClipDrawable, and calling setColorFilter(color) does not help.
  3. Picking GradientDrawable doesn't help either.

There are 3 colors that this progress bar can have. Currently I have made 3 xmls, 1 corresponding to each color, and I load that depending on my condition. I have referred here, but he did not Clip the progress bar, thats the extra thing that I am doing. The problem is, the color values in the xml are dynamic, and I get it from the server, so those three xmls are not of much use, until I can change the color from java. There is a possible solution in level-lists, but I am not very keen in going in that direction, it will be a lot of rework

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:id="@+id/progress_front">
        <clip android:clipOrientation="horizontal" >
            <shape android:shape="rectangle" android:id="myShape">
                <corners
                  android:bottomLeftRadius="360dp"
                  android:topLeftRadius="360dp"
                  android:bottomRightRadius="360dp"                    
                  android:topRightRadius="360dp" />
                **<solid android:color="@color/bigfoodie_text" />**

            </shape>
        </clip>
    </item>

</layer-list>

Any help is appreciated.

Community
  • 1
  • 1
Scrooge
  • 86
  • 7

0 Answers0