View

Sunday, 15 May 2011

how to use a color in horizontal progress bar ?

Create a one folder name as Drawable and create another xml in that folder
res/drawable/myprogressbar.xml

<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="#000000" android:endColor="#000000" />
   <stroke android:width="1dp" android:color="#000000" />
  </shape>
 </item>

 <item android:id="@android:id/progress">
  <clip>
   <shape>
    <corners android:radius="35dip" />
    <gradient android:startColor="#990000" android:endColor="#E6E8FA" />
    <!--
     <stroke android:width="1dp" android:color="#6B8E23" />
    -->
   </shape>
  </clip>
 </item>
</layer-list>


this xml files can show the loading progress bar in a color.

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:orientation="vertical">
    <ProgressBar android:layout_marginLeft="5dp" android:layout_width="250dp" android:progressDrawable="@drawable/myprogressbar" android:id="@+id/progressBar1" android:layout_marginBottom="90dp" android:layout_marginRight="10dp" style="?android:attr/progressBarStyleHorizontal" android:layout_height="wrap_content"></ProgressBar>
</LinearLayout>



2 comments:

  1. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving... very specific nice content.Best Android Training in Velachery | android development course fees in chennai

    ReplyDelete
  2. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.android development course fees in chennai | android app development training in chennai

    ReplyDelete