gpt4 book ai didi

android - 如何以角度剪辑ImageView?

转载 作者:行者123 更新时间:2023-12-03 20:43:43 25 4
gpt4 key购买 nike

如何以角度剪辑ImageView?
喜欢:this

最佳答案

通过 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)
}

关于android - 如何以角度剪辑ImageView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66336274/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com