Make ProgressBar Vertical
Create a drawable in your Drawable
folder called vertical_progress_bar.xml
:
<?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="#ff9d9e9d" android:centerColor="#ff5a5d5a" android:centerY="0.75" android:endColor="#ff747674" android:angle="180" /> </shape> </item> <item android:id="@android:id/secondaryProgress"> <clip android:clipOrientation="vertical" android:gravity="bottom"> <shape> <corners android:radius="5dip" /> <gradient android:startColor="#80ffd300" android:centerColor="#80ffb600" android:centerY="0.75" android:endColor="#a0ffcb00" android:angle="180" /> </shape> </clip> </item> <item android:id="@android:id/progress"> <clip android:clipOrientation="vertical" android:gravity="bottom"> <shape> <corners android:radius="5dip" /> <gradient android:startColor="#ffffd300" android:centerColor="#ffffb600" android:centerY="0.75" android:endColor="#ffffcb00" android:angle="180" /> </shape> </clip> </item> </layer-list>
Create a styles.xml
file in the Resource/Values
folder:
<?xml version="1.0" encoding="utf-8" ?> <resources> <style name="Widget"> </style> <style name="Widget.ProgressBar"> <item name="android:indeterminateOnly">true</item> <item name="android:indeterminateBehavior">repeat</item> <item name="android:indeterminateDuration">3500</item> <item name="android:minWidth">48dip</item> <item name="android:maxWidth">48dip</item> <item name="android:minHeight">48dip</item> <item name="android:maxHeight">48dip</item> </style> <style name="Widget.ProgressBar.Vertical"> <item name="android:indeterminateOnly">false</item> <item name="android:progressDrawable">@drawable/vertical_progress_bar</item> <item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal</item> <item name="android:minWidth">1dip</item> <item name="android:maxWidth">12dip</item> </style> </resources>
Now you should be able to use something like, in your layout:
<ProgressBar android:layout_width="12dip" android:layout_height="300dip" style="@style/Widget.ProgressBar.Vertical" android:id="@+id/progressBar2"/>