The Watch Face Format is required for watch faces to be installed on devices with Wear OS 5 or later pre-installed and for all new watch faces published on Google Play.
Starting in January 2026, the Watch Face Format will be required for watch faces to be installed on all Wear OS devices.
Learn more about the user-facing changes in this Help Center article.
วาดหน้าปัด
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หลังจากกำหนดค่าโปรเจ็กต์และเพิ่มคลาสที่ใช้บริการหน้าปัดแล้ว คุณจะเริ่มเขียนโค้ดเพื่อเริ่มต้นและวาดหน้าปัดที่กำหนดเองได้
หน้าปัดทุกหน้าจะสร้างคลาสย่อยที่กำหนดเองของโปรแกรมแสดงผลซึ่งใช้
ทุกอย่างที่จำเป็นในการวาดหน้าปัด
ตัวแสดงผลจะรวม
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
}
}
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-27 UTC
[null,null,["อัปเดตล่าสุด 2025-08-27 UTC"],[],[],null,["After you configure your project and add a class that implements the\nwatch face service, you can start writing code to initialize and draw your\ncustom watch face.\n\nEvery watch face creates a custom subclass of a renderer that implements\neverything needed to draw the watch face.\n\nThe renderer combines the\n[`UserStyle`](/reference/androidx/wear/watchface/style/UserStyle), the\ncomplication information from\n[`ComplicationSlotsManager`](/reference/androidx/wear/watchface/ComplicationSlotsManager),\nthe current time, and other state information to\nrender the watch face, as shown in the following example: \n\n class CustomCanvasRenderer(\n private val context: Context,\n surfaceHolder: SurfaceHolder,\n watchState: WatchState,\n private val complicationSlotsManager: ComplicationSlotsManager,\n currentUserStyleRepository: CurrentUserStyleRepository,\n canvasType: Int\n ) : Renderer.CanvasRenderer(\n surfaceHolder = surfaceHolder,\n currentUserStyleRepository = currentUserStyleRepository,\n watchState = watchState,\n canvasType = canvasType,\n interactiveDrawModeUpdateDelayMillis = 16L\n ) {\n override fun render(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime) {\n // Draw into the canvas\n }\n\n override fun renderHighlightLayer(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime) {\n // Draw into the canvas\n }\n }"]]