1

Im trying tu customize horizontal progress bar in my application. I want it to have sharp corners (no radius) and blue color (not default yellow or a mix of colors, so I also dont want to be using gradient). The reason Im mentioning these two things is that in every example code I found, the progress bar color was being changed into a color mixture using gradient instead of a simple color. For example in this post:

How to change progress bar's progress color in Android

I was trying to modify this code but with no luck. My question is what is the meaning of the three sections of the code in the answer to the question I linked above? I mean the

@android:id/background
@android:id/secondaryProgress
@android:id/progress

Also when I was trying to get some help from the Eclipse using ctrl+space, it couldnt give me any because the content assist wasnt available at that location. I only want my progress bar to change to a simple color and not to have rounded corners.

Thanks!

Community
  • 1
  • 1

2 Answers2

1

I stole the answer from your link. Something like that should work for you:

<!-- this is the Background Shape of the ProgressBar -->
<item android:id="@android:id/background">
    <shape>
        <!-- you don't want round edges, so I removed it here.
             We dont even need a gradient, replace it with solid -->
      <solid
        android:color="Your bg color" />
    </shape>
</item>

You can edit the other accordingly, where progress is usually a yellow overlay and secondary a grey shadow over the yellow overlay.

Read this documentation for further reference

Rafael T
  • 15,401
  • 15
  • 83
  • 144
1

You should also include tags above shape for progress. Otherwise, progressbar will always show full.

Discovered here after a big headache: http://www.tiemenschut.com/how-to-customize-android-progress-bars/

Hope this helps somebody.