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

Chris Fillmore

04/26/2022, 3:57 PM
Is there some different behaviour for clickable applied to a Canvas? I am having a peculiar problem: My app uses the camera and so there is a SurfaceView showing the preview. Along the bottom of the screen is a row of buttons. Two of the buttons are `IconButton`s and one is a
Canvas(Modifier.clickable {})
. When the device screen is tall enough that the buttons are not floating above the video, all the buttons work as expected. However, some devices have shorter screens, and the buttons float over top the video. In those cases, the IconButtons work normally, but the Canvas clickable does not receive any click events.
I have tried wrapping the Canvas in IconButton, i.e.
Copy code
IconButton(onClick = myClickHandler) {
  Canvas(Modifier) { ... }
}
No effect; the click still doesn’t register
3 Views