Is it possible to specify the bounds of an indicat...
# compose-android
s
Is it possible to specify the bounds of an indication for a custom layout? When someone taps on a row in my
Layout
, I want that row to be indicated, not the entire
Layout
.
c
Any reason the indication isn’t attached to the row?
s
It's a custom
Layout
so there is no row composable.
c
Ah, ok, I misunderstood. I haven’t done any custom layouts so I’m not familiar with this problem.
s
This is my first one, so me either.
l
This won't really work as is currently, you'll need to have a separate indication modifier for each row rather than the whole layout.
s
How would I specify an indication for a particular row?
l
You’d need to have a layout (like a
Box
) per row to put the modifier on - if you want the row itself to be clickable / show indication, then you need some layout that defines this bounds / represents this row
It doesn’t really work with a virtual layout like this, if you need to group multiple elements as one for the purposes of indication or otherwise
On a side note you’d probably find that it would make a bunch of stuff much better here: e.g you wouldn’t need to have this manual pointer input tracking logic, you could just add
Modifier.clickable
to each row, which would also properly implement accessibility that your current implementation doesn’t have support for.
s
Thanks, that was a great idea. I didn't think about the fact that a row doesn't necessarily need to contain anything.