画像を操作する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ウォッチフェイスに画像を使用すると、フルスクリーンの背景画像から個々の詳細画像まで、ウォッチフェイスに魅力を加えることができます。
画像リソースを res/drawable
フォルダ(res/drawable/face.png
など)に配置し、次のように画像を参照します。
<PartImage x="100" y="100" width="250" height="250">
<Image resource="face"/>
</PartImage>
PartImage
要素は、ウォッチフェイス形式の他のコンテナと同様に、スケーリング、回転、変形、色付け、マスクなど、さまざまな方法で変更できます。詳細については、PartImage
のリファレンスをご覧ください。
背景を変える
興味を引く効果の 1 つとして、1 時間ごとに背景を変更する方法があります。これは、Images
要素を使用して実現できます。次に例を示します。
<PartImage ...>
<Images change="ON_NEXT_HOUR">
<Image resource="background1"/>
<Image resource="background2"/>
...
</Images>
</PartImage>
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[null,null,["最終更新日 2025-07-27 UTC。"],[],[],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"]]