Ramotion / fluid-slider-android

:octocat:💧 A slider widget with a popup bubble displaying the precise value selected. Android library made by @Ramotion
https://www.ramotion.com/agency/app-development/
MIT License
1.43k stars 147 forks source link

how to change range size ? #2

Closed farhadsaberi closed 6 years ago

farhadsaberi commented 6 years ago

Hi,

How to change range size from 100 to 45?

dvg4000 commented 6 years ago

For now you can use this code:

val max = 45
fun pos2text(max: Int, pos: Float) = "${(max * pos).toInt()}"

val slider = findViewById<FluidSlider>(R.id.fluidSlider)
slider.positionListener = { slider.bubbleText = pos2text(max, it) }
slider.position = 0.5f
slider.bubbleText = pos2text(max, 0.5f)
slider.startText ="0"
slider.endText = "45"