https://kotlinlang.org logo
#compose
Title
# compose
d

dimsuz

12/22/2021, 1:43 PM
I have
Copy code
Box {
  // 500dp intrinsic width image
  Image(
    painter = painterResource(R.drawable_image_500x56), 
    contentScale = FillHeight,
    alignment = TopStart)
  Text("hello")
}
Currently this box has size
500.dp
due to `Image`'s intrinsic width. But I want this box to have width of the
Text
and for
Image
to be painted and horizontally clipped on the right. Is this possible with default layouts?
m

maciejciemiega

12/22/2021, 4:01 PM
You can try using "Intrinsic measurements" for height/width: https://developer.android.com/jetpack/compose/layouts/intrinsic-measurements e.g.:
Copy code
Box(modifier = modifier.height(IntrinsicSize.Min)) {
d

dimsuz

12/22/2021, 4:06 PM
oh, right! thank you, will try them