I am building an Android Application and I am building a custom progress bar/wheel.
What I want to do is instead of using a plain color to indicate progress, I want to use 2 colors (blue and white for now) but the colors aren't supposed to be gradient, it should just be blue and white next to one another, no gradient whatsoever.
So far, this is what I've tried. I have a gradient_bg.xml
file declared as such:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:type="linear"
android:startColor="#FFFFFFFF"
android:endColor="#FF008080"
android:angle="90"/>
</shape>
and I use it in my code as such:
barPaint.setColor(getResources().getColor(R.drawable.gradient_bg));
However, since it's not a color, I can't use it as a color. If I remove the getResources().getColor()
lines, I end up with with a gray-ish color. Also, another problem I'm anticipating is that when the progress/wheel increments in progress, I will no longer have a Blue-White-Blue-White segment, but rather, a Blue-Blue-White-White segment.