หลังจากกำหนดค่าโปรเจ็กต์และเพิ่มคลาสที่ใช้บริการหน้าปัดแล้ว คุณจะเริ่มเขียนโค้ดเพื่อเริ่มต้นและวาดหน้าปัดที่กำหนดเองได้
หน้าปัดแต่ละหน้าจะสร้างคลาสย่อยที่กำหนดเองของโปรแกรมแสดงผลซึ่งใช้ ทุกอย่างที่จำเป็นในการวาดหน้าปัด
ตัวแสดงผลจะรวม
UserStyle ข้อมูลแทรกจาก
ComplicationSlotsManager
เวลาปัจจุบัน และข้อมูลสถานะอื่นๆ เพื่อ
แสดงผลหน้าปัดนาฬิกา ดังที่แสดงในตัวอย่างต่อไปนี้
class CustomCanvasRenderer(
    private val context: Context,
    surfaceHolder: SurfaceHolder,
    watchState: WatchState,
    private val complicationSlotsManager: ComplicationSlotsManager,
    currentUserStyleRepository: CurrentUserStyleRepository,
    canvasType: Int
) : Renderer.CanvasRenderer(
    surfaceHolder = surfaceHolder,
    currentUserStyleRepository = currentUserStyleRepository,
    watchState = watchState,
    canvasType = canvasType,
    interactiveDrawModeUpdateDelayMillis = 16L
) {
    override fun render(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime) {
        // Draw into the canvas
    }
    override fun renderHighlightLayer(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime) {
        // Draw into the canvas
    }
}