Brian Norman
05/18/2022, 1:03 PMModifier.clip()
like:
val preferBottomContentShape = GenericShape { size, _ ->
moveTo(0f, size.height - desiredHeightPx)
lineTo(size.width, size.height - desiredHeightPx)
lineTo(size.width, size.height)
lineTo(0f, size.height)
}
But the issue there is that there is left over whitespace from the background where the top of that image used to beOleksandr Balan
05/18/2022, 1:10 PMcontentScale
& alignment
on your Image
?
See original, cropped with center alignment and cropped with bottom alignment:
Image(
painter = painterResource(R.drawable.avatar),
contentDescription = null,
)
Image(
painter = painterResource(R.drawable.avatar),
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.height(100.dp)
)
Image(
painter = painterResource(R.drawable.avatar),
contentDescription = null,
contentScale = ContentScale.Crop,
alignment = Alignment.BottomCenter,
modifier = Modifier.height(100.dp)
)
Brian Norman
05/18/2022, 1:15 PMOleksandr Balan
05/18/2022, 1:17 PM