To my knowledge about SeekBar
, you should customize drawables of a SeekBar
to achieve your goal. I have done this and the result is here:
Create a XML drawable file and name it my_seekbar_progress_drawable.xml
(This name is optional you can change it). And then copy and paste this code into that file.
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<gradient
android:startColor="#ffe9e9e9"
android:centerColor="#ffc6c6c6"
android:centerY="0.75"
android:endColor="#ffe9e9e9"
android:angle="270"/>
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:startColor="#ffe9e9e9"
android:endColor="#ff2165ca"
android:angle="270" />
</shape>
</clip>
</item>
</layer-list>
In your layout file where you define your vertical SeekBar
you should specify a width for it. If you write wrap_content
, minimum width will be chosen.
<com.example.myapp.VerticalSeekBar
android:layout_width="20dp"
android:progress="50"
android:progressDrawable="@drawable/my_seekbar_progress_drawable"
android:layout_height="200dp" />
See the result here:
You can play with values in drawable XML file as your wish.