Last active
February 16, 2022 08:54
-
-
Save Antarix/fb9947308c8d5e7eb658 to your computer and use it in GitHub Desktop.
Android Custom horizontal ProgressBar emample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<ProgressBar | |
android:id="@+id/progress_limit" | |
style="?android:attr/progressBarStyleHorizontal" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:indeterminate="false" | |
android:max="100" | |
android:maxHeight="10dip" | |
android:minHeight="10dip" | |
android:progress="50" | |
android:progressDrawable="@drawable/progress_limit" /> | |
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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="5dip" /> | |
<gradient | |
android:angle="270" | |
android:centerColor="#ff5a5d5a" | |
android:centerY="0.75" | |
android:endColor="#ff747674" | |
android:startColor="#ff9d9e9d" /> | |
</shape> | |
</item> | |
<item android:id="@android:id/secondaryProgress"> | |
<clip> | |
<shape> | |
<corners android:radius="5dip" /> | |
<gradient | |
android:angle="270" | |
android:centerColor="#80ffb600" | |
android:centerY="0.75" | |
android:endColor="#a0ffcb00" | |
android:startColor="#80ffd300" /> | |
</shape> | |
</clip> | |
</item> | |
<item android:id="@android:id/progress"> | |
<clip> | |
<shape> | |
<corners android:radius="5dip" /> | |
<gradient | |
android:angle="270" | |
android:endColor="#008000" | |
android:startColor="#33FF33" /> | |
</shape> | |
</clip> | |
</item> | |
</layer-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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="5dip" /> | |
<gradient | |
android:startColor="#ffffffff" | |
android:centerColor="#ffdddddd" | |
android:centerY="0.50" | |
android:endColor="#ffffffff" | |
android:angle="270" /> | |
</shape> | |
</item> | |
<item | |
android:id="@android:id/secondaryProgress"> | |
<clip> | |
<shape> | |
<corners | |
android:radius="5dip" /> | |
<gradient | |
android:startColor="#770e75af" | |
android:endColor="#771997e1" | |
android:angle="90" /> | |
</shape> | |
</clip> | |
</item> | |
<item | |
android:id="@android:id/progress"> | |
<clip> | |
<shape> | |
<corners | |
android:radius="5dip" /> | |
<gradient | |
android:startColor="#ff0e75af" | |
android:endColor="#ff1997e1" | |
android:angle="90" /> | |
</shape> | |
</clip> | |
</item> | |
</layer-list> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
well done!