【发布时间】:2021-02-23 15:39:50
【问题描述】:
【问题讨论】:
标签: android imageview android-imageview degrees
【问题讨论】:
标签: android imageview android-imageview degrees
通过path.arcTo 和canvas.clipPath 找到了解决方案。
private val oval = RectF()
override fun onDraw(canvas: Canvas) {
val x = width/2f
val y = height/2f
val radius = width/2f
oval.left = x - radius
oval.top = y - radius
oval.right = x + radius
oval.bottom = y + radius
val path = Path()
path.moveTo(x,y)
path.arcTo(oval, startAngle, sweepAngle)
path.close()
canvas.clipPath(path);
super.onDraw(canvas)
}
【讨论】: