Hey :wave: Is there any substitute to `adjustViewB...
# compose
n
Hey 👋 Is there any substitute to
adjustViewBounds
in Compose’s
Image
? I want an image’s height to be driven by the width + keep original aspect ratio so I’m using
Copy code
alignment = Alignment.Center,
contentScale = ContentScale.FillWidth,
but this creates vertical padding that I want to get rid of. In traditional view system I would just ad
adjustViewBounds=true
.
I’ve seen people using
Modifier.aspectRatio
for this but I’d want to avoid calculating the aspect ratio manually if possible since I’m working with
android.net.Uri
and I don’t want to open the file twice.
c
Did you figure out a good solution here? I'm fine with using aspect ratio, but even when I use it I still get a bit of empty space on top and bottom.
n
No, I’m just waiting for something built in which I guess will come. For now I’m just calculating the aspect ratio.
c
Even calculating the aspect ratio doesn't work for me. Hmm.. @Nacho Ruiz Martin please star if you want. I just filed! https://issuetracker.google.com/issues/196358649
n
Thanks, man
282 Views