You can apply a custom shape to an Image
composable.
Something like:
Image(
painter = painterResource(R.drawable.xxx),
contentDescription = "xxxx",
contentScale = ContentScale.Crop,
modifier = Modifier
.size(100.dp)
.clip(
RoundedCornerShape(
topStartPercent = 50,
topEndPercent = 0, //square corner
bottomEndPercent = 50,
bottomStartPercent = 50
)
)
)
Otherwise you can define you custom path using:
class MyShape(topStart: CornerSize) : Shape {
override fun createOutline(
size: Size,
layoutDirection: LayoutDirection,
density: Density
): Outline {
val myPath = Path().apply {
//....
}
return Outline.Generic(path = myPath)
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.