I have an `Image` which has `fillMaxSize()` and `c...
# compose
d
I have an
Image
which has
fillMaxSize()
and
contentScale = FillBounds
, but the painter is still drawn in center of the image, why is that? It seems that contentScale is completely ignored (example in the thread)
Copy code
Box {
      Image(
        modifier = Modifier.fillMaxWidth().height(100.dp),
        painter = painterResource(id = R.drawable.img_toolbar_background_360x76),
        contentScale = ContentScale.FillBounds,
        contentDescription = null
    )
}
n
I think you are looking for the alignment parameter. ContentScale determines how the painter should be sized within the bounds of the Image composable while alignment determines the position of it.
d
it's set to Center. And I want to stretch the painter to the bounds of an image, but it looks like it doesn't
n
Do you have a mock of how you want it to render in this case?
d
oh, wait, looks like my png had shadow layer baked in and it was affecting the bounds. sorry, my bad!