Thursday, 18 August 2011

Android tutorial to Change horizontal progress bar color and border

In this Android Tutorial i will tell you how to create your own custom progress bar 
Below are the steps to create your own custom progress bar.
 Just follow the steps :

STEP - 1)

main.xml:(add this to your main.xml):

<ProgressBar
android:id="@+id/ProgressBar01"
android:layout_width="121dp"
android:layout_height="15dp"
android:progress="50"
android:max="100"
android:secondaryProgress="0"
style="?android:attr/progressBarStyleHorizontal"
android:progressDrawable="@drawable/myprogressbar"
android:layout_marginTop="10dp"
/>
</LinearLayout>


 
 STEP - 2) 
myprogressbar.xml (save this xml in drawable folder)

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
        <shape>
            <corners android:radius="25dip" />
            <gradient android:startColor="#C0C0C0" android:centerColor="#F8F8FF"
                android:centerY="0.75" android:endColor="#ffffff" android:angle="90" />
            <stroke android:width="1dp" android:color="#6B8E23" />
        </shape>
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape>
                <corners android:radius="25dip" />
                <gradient android:startColor="#9ACD32" android:endColor="#FFFF00"
                    android:angle="90" />
                <stroke android:width="1dp" android:color="#6B8E23" />
            </shape>
        </clip>
    </item>
</layer-list>

12 comments:

iOS Tutorial on Enumeration  So as we are talking about enumeration in iOS,the first thing comes into mind are Collections such as Array...