How to change Progress bar color in android?
- Please make one xml file name progress.xml and put it in res/xml folder and write the below code in that xml file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0" android:toDegrees="360"> <shape android:shape="ring" android:innerRadiusRatio="3" android:thicknessRatio="8" android:useLevel="false"> <size android:width="76dip" android:height="76dip" /> <gradient android:type="sweep" android:useLevel="false" android:startColor="#0077CC" android:endColor="#23A1D1" android:angle="0" /> </shape> </rotate> |
- create ProgressBar in our Layout
123456789101112131415<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center_horizontal" ><ProgressBarandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:layout_alignParentBottom="true"android:background = "@xml/progress"android:layout_marginBottom="120dp" /></RelativeLayout>