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.
最佳化錶面
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
由於 Wear OS 錶面需要持續運作,因此必須有效利用電力。
請儘可能最佳化錶面的效能。本頁面將介紹整體錶面最佳化的最佳做法,以及針對動畫和圖片的最佳做法。
基本最佳化
本節將說明改善錶面整體效率的最佳做法。
錶面顏色和亮度
在錶面上使用深色可減少使用者智慧手錶的耗電量。以下是設定錶面背景時推薦考量的事項,以便幫助您最佳化錶面使用電池的方式:
- 「Color」︰儘可能使用黑色背景。
- 「Brightness」︰如果無法使用黑色背景,請在色相、飽和度、明度 (HSV) 或色相、飽和度、亮度 (HSB) 標度上,將背景顏色的亮度保持在 25% 或以下。舉例來說,如果您使用
Color
類別來設定以 HSV 標度定義的背景顏色,則設定值不要超過 25,以利於控制亮度。
使用動態功能和手機互動
如果錶面需要用手機進行操作,請勿在錶面非活動時候執行程式碼。如果想讓手機應用程式偵測對應的錶面是否為活動狀態,建議您使用 CapabilityClient API。
監控耗電量
開發人員和使用者可以藉由 Wear OS 隨附應用程式查看穿戴式裝置各程序所消耗的電池電量。如要查看這項內容,請依序前往「Settings」>「Watch battery」。
註冊可偵測加密功能的錶面
Android 7.0 以上版本支援檔案加密功能,並可在使用者啟動並提供加密密碼之前就先執行可偵測加密功能的應用程式。這樣做可以加快從啟動動畫到錶面的轉場時間,最多可加快 30 秒。
如果想加快啟動時間,請在錶面資訊清單中加入 android:directBootAware="true"
。
注意:請在未採用憑證加密儲存空間的錶面上使用此功能。
動畫最佳做法
本節將說明可協助降低動畫關聯耗電情況的最佳做法。
降低動畫的畫面更新率
動畫通常會消耗大量的運算資源及電力。大多數的動畫都可用 30 每秒影格數達到流暢的效果,因此請避免讓動畫使用比這更高的畫面更新率。您可以改用動態畫面更新率。詳情請參閱 Canvas 錶面範例。
讓 CPU 在每次播放動畫之間休眠
為了儘可能延長電池續航力,請您少用動畫。就算只是讓冒號閃爍,每次閃爍也會消耗電池電量。
當系統播放動畫和更新錶面少量內容時會喚醒 CPU。在動畫間讓 CPU 進入休眠狀態,例如您可以在錶面互動模式時每秒播放短促的動畫,然後讓 CPU 休眠,直到下一秒來臨。藉由讓 CPU 經常休眠,就算每次休眠時間都很短,也能大幅降低電力消耗。
圖片的最佳做法
本節將說明可協助降低圖片關聯耗電情況的最佳做法。
縮減點陣圖素材資源大小
許多錶面都由背景圖片和其他圖像資源組成,而圖像資源會變形並覆蓋在背景圖片上,例如指針和其他會隨著時間移動的元素。這些圖像資源越大,變形就需要消耗更多的運算資源。一般來說,每當系統重新繪製錶面時,這些位於 Render.CanvasRenderer.render()
的圖像元素就會旋轉,有時則會縮放,請參閱「繪製錶面」的說明。
圖 1. 藉由裁剪指針移除多餘像素。
如果減少點陣圖素材資源的大小,不僅可以改善動畫效能,也有助於節省電量。請按照下列提示改善錶面的效能:
- 請勿使用大於實際需求的圖像元素。
- 移除邊緣多餘的透明像素。
例如,透過移除額外的透明像素,圖 1 左側的時鐘指針圖片的尺寸可減少 97%,如圖右側所示。
合併點陣圖素材資源
如果有經常需要一起繪製的點陣圖,不妨考慮把這些點陣圖合併成單一圖像資源。例如,您通常可以將互動模式的背景圖片和刻度記號合併成一個資源,以避免讓系統每次重新繪製錶面時都必須繪製兩個全螢幕的點陣圖。
在繪製縮放過的點陣圖時停用反鋸齒
使用
Canvas.drawBitmap()
方法在 Canvas
物件上繪製縮放過的點陣圖時,您可以藉由提供 Paint
執行個體進行多種設定。為了提升效能,請用 setAntiAlias()
方法停用反鋸齒,因為這個選項對點陣圖沒有效果。
圖 2. 停用點陣圖濾鏡 (左) 和啟用濾鏡 (右) 的範例。
使用點陣圖濾鏡
如果您需要在其他元素上繪製點陣圖素材資源,請用 setFilterBitmap()
方法在同一個 Paint
執行個體上啟用點陣圖濾鏡。圖 2 放大顯示了啟用點陣圖濾鏡前後的指針外觀。
注意︰請在使用微光模式時停用點陣圖濾鏡。在低位元率的微光模式下,系統無法確實轉譯圖片色彩,因此無法正確處理點陣圖濾鏡。
把耗費較多資源的操作移出繪圖方法
每次重新繪製錶面時,系統都會呼叫 Render.CanvasRenderer.render()
方法。您為了改善效能只能納入此方法時,必須嚴格更新錶面所需的作業。
請儘量避免在 Render.CanvasRenderer.render()
方法中執行下列作業:
- 載入圖片和其他資源
- 調整圖片大小
- 分配物件
- 影格之間的運算結果不會改變
您可以使用 CPU 分析器檢測錶面效能。尤其請特別注意 Render.CanvasRenderer.render()
實作的執行時間是否很短,且每次叫用都能保持相近的時間。詳情請參閱「使用 CPU 分析器查看 CPU 活動」。
錶面範例應用程式會示範設定錶面的最佳做法。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-26 (世界標準時間)。"],[],[],null,["# Optimize watch faces\n\nA Wear OS watch face runs continuously, so it must use power efficiently.\n\nOptimize the performance of the watch face as much as possible.\nThis page provides best practices for overall watch face optimizations as well as\nbest practices targeted to animations and images.\n\nBasic optimization\n------------------\n\nThis section contains best practices for improving the overall efficiency of your watch face.\n\n### Watch face color and brightness\n\nUsing dark colors in your watch face draws less power from the user's watch.\nThe following are recommendations for setting the watch face background\nto optimize the watch face's battery use:\n\n- **Color:** whenever possible, use a black background.\n- **Brightness:** when a black background is not possible, keep the brightness of the background color at or below 25% on a hue, saturation, value (HSV) or hue, saturation, brightness (HSB) scale. For example, if you use the [`Color`](/reference/android/graphics/Color) class to set a background color defined with the HSV scale, use 25 or lower for the value setting, which controls brightness.\n\n### Use dynamic capabilities to interact with the phone\n\nWhen a watch face requires an operation to run on the phone, execute the code only\nwhen the watch face is active. The recommended method for letting the app on the phone learn that\nthe corresponding watch face is active is the\n[CapabilityClient API](https://developers.google.com/android/reference/com/google/android/gms/wearable/CapabilityClient).\n\n### Monitor power consumption\n\nThe [Wear OS companion app](https://play.google.com/store/apps/details?id=com.google.android.wearable.app&hl=en) lets developers and users see how much battery\nis consumed by different processes\non the wearable device. To see this, navigate to **Settings** \\\u003e **Watch\nbattery**.\n\n### Register encryption-aware watch faces\n\nAndroid 7.0 and higher include support for file-based encryption and let\n[encryption-aware](/training/articles/direct-boot) applications\nrun before the user has provided the decryption passcode at bootup. This can reduce the\nduration of transitioning from boot animation to the watch face by up to 30 seconds.\n\nTo enable faster bootup, add `android:directBootAware=\"true\"` to the watch face\nmanifest.\n\n**Note:** Use this feature with watch\nfaces that don't use credential-encrypted storage.\n\nBest practices for animations\n-----------------------------\n\nThe best practices in this section help reduce the power consumption associated with\nanimations.\n\n### Reduce the frame rate of animations\n\nAnimations are often computationally expensive and consume a significant amount of power. Most\nanimations look fluid at 30 frames per second, so avoid running your animations\nat a higher frame rate. Instead, you can use dynamic frame rates. For more information, see the\n[Example Canvas Watch Face](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:wear/watchface/watchface/samples/src/main/java/androidx/wear/watchface/samples/ExampleCanvasDigitalWatchFaceService.kt;l=893?q=this.interactiveDrawModeUpdateDelayMillis%20%3D).\n\n### Let the CPU sleep between animations\n\nTo maximize battery life, use animations sparingly. Even a blinking colon uses battery\npower with every blink.\n\nAnimations and small changes to the contents of the watch face wake up the CPU.\nLet the CPU sleep between animations by, for example, using short bursts of\nanimation every second in interactive mode and then letting the CPU sleep until the next second.\nLetting the CPU sleep often, even briefly, can significantly reduce power consumption.\n\nBest practices for images\n-------------------------\n\nThe best practices in this section help reduce the power consumption associated with\nimages.\n\nReduce the size of your bitmap assets\n-------------------------------------\n\nMany watch faces consist of a background image plus other graphic assets that are transformed\nand overlaid onto the background image, such as clock hands and other elements\nthat move over time. The larger these graphic assets are, the more computationally expensive it is\nto transform them. Typically, these graphic elements are rotated, and sometimes scaled, inside the\n[`Render.CanvasRenderer.render()`](/reference/kotlin/androidx/wear/watchface/Renderer.CanvasRenderer#render(android.graphics.Canvas,android.graphics.Rect,java.time.ZonedDateTime)) method every time the system redraws the watch face,\nas described in [Draw a watch face](/training/wearables/watch-faces/drawing#Drawing). \n\n\n**Figure 1.** Crop clock hands to remove extra pixels.\n\nReducing the size of your bitmap assets improves\nthe performance of your animations and saves power.\nFollow these tips to improve the performance of your watch face:\n\n- Don't use graphic elements that are larger than you need.\n- Remove extra transparent pixels around the edges.\n\nFor example, the size of the clock hand image on the left in figure 1 can be reduced\nby 97% by removing the extra transparent pixels, as shown on the right side of the figure.\n\nCombine bitmap assets\n---------------------\n\nIf you have bitmaps that are often drawn together, consider combining them into a single\ngraphic asset. For example, you can often combine the background image in interactive mode with the tick\nmarks to avoid drawing two full-screen bitmaps every time the system redraws the watch face.\n\nDisable anti-aliasing when drawing scaled bitmaps\n-------------------------------------------------\n\nWhen you draw a scaled bitmap on the\n[Canvas](/reference/android/graphics/Canvas) object using the\n[Canvas.drawBitmap()](/reference/android/graphics/Canvas#drawBitmap(android.graphics.Bitmap, float, float, android.graphics.Paint)) method, you can provide a\n[Paint](/reference/android/graphics/Paint) instance to configure\nseveral options. To improve performance, disable anti-aliasing using the\n[setAntiAlias()](/reference/android/graphics/Paint#setAntiAlias(boolean))\nmethod, since this option doesn't have any effect on bitmaps. \n\n**Figure 2.** Example of bitmap filtering disabled (left) and\nenabled (right).\n\nUse bitmap filtering\n--------------------\n\nFor bitmap assets that you draw on top of other elements, enable bitmap filtering on the same\n`Paint` instance using the\n[setFilterBitmap()](/reference/android/graphics/Paint#setFilterBitmap(boolean))\nmethod. Figure 2 shows a magnified view of a clock hand with\nand without bitmap filtering.\n\n**Note:** When ambient mode is\nactive, disable bitmap filtering. In low-bit ambient mode, the system does not reliably\nrender the colors in the image for bitmap filtering to process successfully.\n\nMove expensive operations outside the drawing method\n----------------------------------------------------\n\nThe system calls the `Render.CanvasRenderer.render()`\nmethod every time it redraws your watch face. To improve performance, only include\noperations inside this method that are strictly required to update the watch face.\n\n\nWhen possible, avoid performing the following operations inside the\n`Render.CanvasRenderer.render()` method:\n\n- Loading images and other resources\n- Resizing images\n- Allocating objects\n- Computations whose results don't change between frames\n\nTo analyze the performance of your watch face, use the CPU Profiler. In particular,\nmake sure that the execution time for your `Render.CanvasRenderer.render()`\nimplementation is short and\nconsistent across invocations. For more information, see\n[Inspect CPU activity with CPU Profiler](/studio/profile/cpu-profiler).\n\nRelated resources\n-----------------\n\n\nThe\n[watch face sample app](https://github.com/android/wear-os-samples) demonstrates the best practices for configuring a watch face."]]