hi all, when using compose i have the following ``...
# compose
b
hi all, when using compose i have the following
Copy code
BoxWithConstraints {
   Image(painter = painterResource(id = R.drawable.image), contentDescription = null)
}
how can i make the image
width == parent's width
but the height to keep a constant ration as the original image?
c
Use the ratio modifier (with like 16/9f) + fillMaxWidth
No need for BWC
a
To maintain the original aspect ratio, you can simply use
contentScale = ContentScale.FillWidth
.
👍 2
c
@Albert Chang no boxWithConstraints needed, right?
a
Yep
👍 3