Thread
#compose
    Nacho Ruiz Martin

    Nacho Ruiz Martin

    1 year ago
    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
    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.
    Colton Idle

    Colton Idle

    1 year ago
    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.
    Nacho Ruiz Martin

    Nacho Ruiz Martin

    1 year ago
    No, I’m just waiting for something built in which I guess will come. For now I’m just calculating the aspect ratio.
    Colton Idle

    Colton Idle

    1 year ago
    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
    Nacho Ruiz Martin

    Nacho Ruiz Martin

    1 year ago
    Thanks, man