I've made a custom vertical progress bar and I want to 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 is What I wanted
Of course I couldn't achieve exactly like this But I only want to show labels alongside this now. I know I can make another vertical layout and show textview labels but that would be too messy. Is there any way I could adjust it in layer-list layout.