Issue
I wanto to create a circle progress bar with a drawable with 2 solid colors. At the moment I have a gradient progress bar like this.
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="-90"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="270" >
<shape
android:shape="ring"
android:useLevel="false" >
<gradient
android:centerY="1"
android:startColor="#0099CC"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
How Can I achieve this?
Solution
We can use this xml:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Background -->
<item
android:id="@android:id/background"
android:drawable="@drawable/progress_bar_off"/>
<!-- Secondary progress - this is optional -->
<item android:id="@android:id/secondaryProgress">
<clip android:drawable="@drawable/progress_bar_secondary" />
</item>
<!-- Progress -->
<item android:id="@android:id/progress">
<clip android:drawable="@drawable/progress_bar_on" />
</item>
</layer-list>
Answered By - Ahmad Aghazadeh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.