0

I want 0 value(the base number of the ruler) in middle,and when seekbar changed,current progress to 0 value can show white like below.I use System Seekbar,and my progressDrawable 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 android:shape="rectangle">
            <solid android:color="@color/appColorDefault" />
            <corners android:radius="2dp" />
        </shape>
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape android:shape="rectangle">
                <solid android:color="@color/appColorAccent" />
                <corners android:radius="2dp" />
            </shape>
        </clip>
    </item>
</layer-list>

This 0 value only in start,can't in middle.How to do this?Thank you for your helps.


Pic update.The point is not to set it to less than 0,the key is how to display the white progress bar from current pos(eg. current is -30) to base value(0 value,in middle of the seekbar). I found a possible solution in this link:StartPointSeekBar,but this library is 2015,I'm trying it and see if it works

enter image description here

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
candrwow
  • 511
  • 5
  • 21

2 Answers2

0

It is your charge to set the value you want with your own mapping.

For example : 0 stands for -100, 50 for 0 and 100 for 100

Bruno
  • 3,872
  • 4
  • 20
  • 37
0

Here is answer,Same author,Github Library:StartPointSeekBar,This library can work on AndroidX,but it lacks some interfaces compared to seekbar on androidx,such as below

override fun onStartTrackingTouch(seekBar: SeekBar?) {}
override fun onStopTrackingTouch(seekBar: SeekBar?) {}
candrwow
  • 511
  • 5
  • 21