How to set seekbar min and max value

前端 未结 14 895
栀梦
栀梦 2020-11-28 09:17

I have a seekbar and trying to set the value from 60 to 180 for one and 40 to 190 for the second one in step of 1.

sb1 = (SeekBar) findViewById(R.id.progress         


        
14条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 09:37

    If you are using the AndroidX libraries (import androidx.preference.*), this functionality exists without any hacky workarounds!

        val seekbar = findPreference("your_seekbar") as SeekBarPreference
        seekbar.min = 1
        seekbar.max = 10
        seekbar.seekBarIncrement = 1
    

提交回复
热议问题