處理圖片
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
在錶面中使用圖片可讓錶面更生動,從全螢幕背景圖片到個別細節圖片,都能增添趣味。
將圖片資源放入 res/drawable
資料夾 (例如 res/drawable/face.png
),然後如以下方式參照圖片:
<PartImage x="100" y="100" width="250" height="250">
<Image resource="face"/>
</PartImage>
PartImage
元素與錶面格式中的其他容器一樣,可以透過多種方式進行修改,包括縮放、旋轉、轉換、著色或遮罩。詳情請參閱 PartImage
參考資料。
變更背景
每小時變更背景效果,可以讓觀眾更感興趣。您可以使用 Images
元素達成此目的,例如:
<PartImage ...>
<Images change="ON_NEXT_HOUR">
<Image resource="background1"/>
<Image resource="background2"/>
...
</Images>
</PartImage>
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Work with images\n\nUsing images in your watch face can really help bring it to life, from a\nfull-screen background image to individual detail images to add interest.\n\nPlace your image resources in the `res/drawable` folder, for example\n`res/drawable/face.png`, and then reference the image as follows: \n\n \u003cPartImage x=\"100\" y=\"100\" width=\"250\" height=\"250\"\u003e\n \u003cImage resource=\"face\"/\u003e\n \u003c/PartImage\u003e\n\nThe `PartImage` element, as with other containers in Watch Face Format,\ncan be modified in\nmany ways, including being scaled, rotated, transformed, tinted, or masked.\nSee the [`PartImage`](/training/wearables/wff/group/part/image/part-image) reference for more information.\n\n### Vary the background\n\nOne effect that can provide interest is to change the background every hour.\nThis can be achieved through the use of the `Images` element, for example: \n\n \u003cPartImage ...\u003e\n \u003cImages change=\"ON_NEXT_HOUR\"\u003e\n \u003cImage resource=\"background1\"/\u003e\n \u003cImage resource=\"background2\"/\u003e\n ...\n \u003c/Images\u003e\n \u003c/PartImage\u003e"]]