android - Custom Vertical Progress Bar -


i've made custom vertical progress bar , want show labels along side it.

<?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>             <solid android:color="#777" />         </shape>     </item>     <item android:id="@android:id/progress">         <layer-list>             <item>                 <clip                     android:cliporientation="vertical"                     android:gravity="bottom">                     <shape>                         <gradient                             android:angle="90"                             android:centercolor="#ffff00"                             android:endcolor="#ff0000"                             android:startcolor="#00ff00" />                     </shape>                 </clip>             </item>             <item>                 <clip                     android:cliporientation="vertical"                     android:gravity="fill">                     <layer-list>                         <item android:top="75dp">                             <shape android:shape="line">                                 <stroke                                     android:width="2dp"                                     android:color="#333" />                             </shape>                         </item>                          <item android:top="25dp">                             <shape android:shape="line">                                 <stroke                                     android:width="2dp"                                     android:color="#333" />                             </shape>                         </item>                          <item android:bottom="25dp">                             <shape android:shape="line">                                 <stroke                                     android:width="2dp"                                     android:color="#333" />                             </shape>                         </item>                          <item android:bottom="75dp">                             <shape android:shape="line">                                 <stroke                                     android:width="2dp"                                     android:color="#333" />                             </shape>                         </item>                     </layer-list>                 </clip>             </item>         </layer-list>     </item> </layer-list> 

usage:

<progressbar     style="@android:style/widget.progressbar.horizontal"     android:layout_width="10dp"     android:layout_height="match_parent"     android:layout_margintop="@dimen/form_items_margin"     android:layout_gravity="center"     android:max="100"     android:progress="90"     android:progressdrawable="@drawable/progress_drawable_vertical" /> 

this mine looks this mine looks like

this wanted

this wanted

of course couldn't achieve want show labels alongside now. know can make vertical layout , show textview labels messy. there way adjust in layer-list layout.


Comments