Search code examples
androidxmlkotlinnavigation-drawerseekbar

How to implement seekbar discrete with replacing tick mark from dot to numbers in navigation drawer . Is it possible at all


<SeekBar
    android:id="@+id/seekBar2"
    style="@style/Widget.AppCompat.SeekBar.Discrete"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:thumb="@drawable/ic_circle"
    android:max="7"
    android:progress="3"/>

https://i.sstatic.net/NBU9Z.jpg

How to implement seekbar discrete with replacing tick mark from dot to numbers in navigation drawer . Is it possible at all.


Solution

  • Play with values and use enum :

    public static final String VAL1 = "A8";
    public static final String VAL2 = "A1";
    public static final String VAL3 = "A5";
    public static final String VAL4 = "A1";
    
    public static enum Suit { VAL1, VAL2, VAL3, VAL4 }
        
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) 
    {
         progressChangedValue = progress;
         setProgresValue(Suit(progressChangedValue));
    }
    

    Or use a library like https://github.com/warkiz/IndicatorSeekBar