Hey :wave::skin-tone-3: I hope you can help me wit...
# compose
s
Hey 👋🏼 I hope you can help me with a layout issue in Compose (Android): I have a
Box
(orange) containing an
Image
with a specific aspect ratio and slight rotation (first box in attached image). Now I want to reduce the height of the
Box
while the
Image
behaves as if it still has the full height available (second box of attached image). If I’m using just
height()
on the
Box
, the
Image
will be scaled. So basically I just want to show a specific “view port” of the
Image
, like looking out a window. If I use
drawWithContent()
in conjunction with
clipRect()
on the
Box
, I get the desired visual representation however the
Box
still has the original height, which is not what I need. Any ideas?
a
Maybe
Modifier.height().wrapContentHeight(align = <http://Alignment.Top|Alignment.Top>)
s
@Albert Chang Yes, thank you! That’s it. I also needed to specify
unbounded = true
since the content’s measured height is larger than the maximum height constraint 🎉
Hm, however putting that
Box
now in a
Column
with a
Text
below, the
Text
is displayed over the
Box
🤔 Have to investigate further …