Skip to content

Instantly share code, notes, and snippets.

@DawnImpulse
Last active November 23, 2020 03:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DawnImpulse/d92c81d87736789e234fbd1c6e396e85 to your computer and use it in GitHub Desktop.
Save DawnImpulse/d92c81d87736789e234fbd1c6e396e85 to your computer and use it in GitHub Desktop.
Creating gradient drawable for progress bar in android
<?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="5dp"/>
<solid android:color="#fff"/>
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dp"/>
<gradient
android:endColor="@android:color/holo_red_dark"
android:startColor="@android:color/holo_orange_light"
/>
</shape>
</clip>
</item>
</layer-list>
<ProgressBar
xmlns:tools="http://schemas.android.com/tools"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="10dp"
android:progressDrawable="@drawable/gradient_progress"
tools:progress="60"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment