我想创建或绘制椭圆形。
我已经做了如下
class CustomOvalShape : Shape {
override fun createOutline(
size: androidx.compose.ui.geometry.Size,
layoutDirection: LayoutDirection,
density: androidx.compose.ui.unit.Density
): Outline {
val path = Path().apply {
val rect = Rect(0f, 0f, size.width, size.height)
addOval(rect)
}
return Outline.Generic(path)
}
}
我正在使用jetpack composeKotlin,当我使用above class时,我得到了如下错误:
Inheritance from an interface with '@JvmDefault' members is only allowed with -Xjvm-default option
我该怎么解决这个问题?
1条答案
按热度按时间dly7yett1#
使用KotlinCompose绘制椭圆形,如下所示-