Is there a way to change orientation in a local sc...
# compose
v
Is there a way to change orientation in a local scope? 🤔 For example having a horizontal orientation layout inside a vertical orientation layout?
z
How are you determining orientation?
v
I'm thinking about the direction Row and Column layout items, the constraints reported for width and height and the way Alignments work. My first idea was to use
.rotate(90f)
but that doesn't work with sizing and Alignment at least.
z
The question I should have asked is, what are you actually trying to do?
v
Ah, that is a good question. Might be an XY problem here 😅 I have an embedded device running only a single application and some of the screens are designed to be used in landscape orientation, while most of the screens are in vertical orientation. I was trying to avoid changing the android orientation since it causes a rotation animation. (The embedded device has status/navigation bars disabled so the orientation of those don't matter)
z
Is it a custom android build? Could you just disable the system rotation animation?
I feel like even if you get this to work in compose, if you’re fighting the OS it’s gonna create weird little edge cases or future problems.
👍 1
That said, rotating via a graphics layer should work I think, since that applies to transform to all three of drawing, layout coordinates, and pointer events. It might not work completely with a11y since a11y services won’t be aware of your “fake” orientation. And you’ll have to swap the constraints yourself, which is probably causing the issues you saw.
gratitude thank you 1
v
Yeah, it's a custom android build but we unfortunately don't control it, so can't disable it on that level. Thanks for the insight anyways blob smile happy I think we will just go with the system orientation change or possibly graphics layer rotate if I get the constraints working.