Friday, March 11, 2016

Progress Bar with Custom Color

Create one xml folder in layout and put the my_progress.xml file in it .

my_porgress.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toDegrees="360">
    <shape
        android:innerRadiusRatio="3"
        android:shape="ring"
        android:thicknessRatio="8"
        android:useLevel="false">
        <size
            android:width="76dip"
            android:height="76dip" />
        <gradient
            android:angle="0"
            android:endColor="#447a29"
            android:startColor="#447a29"
            android:type="sweep"
            android:useLevel="false" />
    </shape>
</rotate>

Set startColor and endColor as per your choice and 
Create a progress bar insile your main layout as 

<ProgressBar
  android:id="@+id/ProgressBar01" 
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:background ="@layout/my_progress">


No comments:

Post a Comment