Slide 6
Slide 6 text
ԁΛඳ͍ͯΈΔ🙆
class DrawCircleView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
private val paint = Paint().apply {
//
ͲͷΑ͏ʹඳը͢Δ͔
color = Color.BLUE
}
override fun onDraw(canvas: Canvas) {
val radius = width.toFloat() / 2
//
ԿΛඳը͢Δ͔
canvas.drawCircle(
(width / 2).toFloat(),
//
center x
(height / 2).toFloat(),
//
center y
radius,
//
radius
paint
//
paint
)
}
}