Thinking about touching and holding the finger on the screen. How can I detect the touch is over a specific composable?
j
jim
03/16/2023, 3:02 PM
It's not clear from your description what you're trying to accomplish. Are you trying to detect long press, or something more advanced?
If you're trying to detect long-press, the following should work for you:
Copy code
Modifier.pointerInput(Unit) {
detectTapGestures(
onPress = { /* Called when the gesture starts */ },
onDoubleTap = { /* Called on Double Tap */ },
onLongPress = { /* Called on Long Press */ },
onTap = { /* Called on Tap */ }
)
}
to get a better sense of how gesture detection is implemented.
t
Tgo1014
03/16/2023, 3:09 PM
It's not long press, I would need the user to tap a button and then some extra buttons would show, then the user can drag the finger to these buttons and when released it would trigger a callback
Tgo1014
03/16/2023, 3:09 PM
So it would be nice to have a way to detect the touch is over one of these input