https://kotlinlang.org logo
#compose
Title
# compose
o

Omkar Amberkar

01/24/2023, 12:22 AM
given an offset, how do i align my composable in a way that it is centered to that offset?
I know the offset from the slider and now want to show the label on top of slider thumb in a way that is centered to the thumb position
e

ephemient

01/24/2023, 3:19 AM
Copy code
Modifier.layout { measureable, constraints ->
    val placeable = measureable.measure(constraints)
    layout(placeable.width, placeable.height) {
        place(offsetX - placeable.width / 2, 0)
    }
}
d

dazza5000

10/24/2023, 7:44 PM
Do you have a full implementation for a slider with a label?
6 Views