ปรับเปลี่ยนในแบบของคุณด้วยรูปภาพ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หมายเหตุ: ฟีเจอร์นี้พร้อมใช้งานใน Watch Face Format เวอร์ชัน 4 ขึ้นไป
การให้ผู้ใช้เลือกรูปภาพที่จะรวมไว้ในหน้าปัดจะช่วยเพิ่มความเป็นส่วนตัวให้กับประสบการณ์การใช้งานหน้าปัด
ส่วนการทํางานกับรูปภาพมีวิธีแสดงรูปภาพในหน้าปัดอยู่แล้ว หากต้องการอนุญาตให้ผู้ใช้เลือกจากรูปภาพที่กําหนดไว้ล่วงหน้า ให้ใช้ ListConfiguration
ตามที่แสดงในส่วนกําหนดการกําหนดค่าของผู้ใช้
หากต้องการใช้รูปภาพในหน้าปัดที่ผู้ใช้สามารถกำหนดค่าได้ ให้ใช้องค์ประกอบ <PhotosConfiguration>
ดังนี้
<UserConfigurations>
<PhotosConfiguration id="photoConfig" configType="SINGLE"/>
</UserConfigurations>
configType
อาจเป็น SINGLE
หรือ MULTIPLE
ซึ่งระบุว่าผู้ใช้จะเลือกรูปภาพเดียวภายในโฆษณาที่แสดงร่วมกันหรือคอลเล็กชันรูปภาพได้หรือไม่
รองรับรูปภาพเดียว
สำหรับกรณีที่ใช้รูปภาพเดียว คุณสามารถใช้รูปภาพภายในองค์ประกอบ PartImage
ดังนี้
<PartImage ...>
<Photos source="[CONFIGURATION.photoConfig]" defaultImageResource="default_image"/>
</PartImage>
โปรดสังเกต defaultImageResource
ซึ่งจะแสดงเมื่อผู้ใช้ไม่ได้เลือกรูปภาพในอุปกรณ์เสริม และเป็นแอตทริบิวต์ที่จำเป็น
หากต้องการเลือกรูปภาพอื่น ผู้ใช้ต้องใช้แอปที่ใช้ร่วมกันเพื่อแทนที่รูปภาพที่มีอยู่แล้วด้วยรูปภาพอื่น
รองรับรูปภาพหลายรูป
การใช้ PhotosConfiguration
กับ configType="MULTIPLE"
ช่วยให้หน้าปัดแสดงรูปภาพจากคอลเล็กชันได้ ซึ่งจะวนดูรูปภาพได้โดยแตะหรือจะวนดูโดยอัตโนมัติหลังจากดูรูปภาพหลายรูปแล้วก็ได้
<Photos change="ON_VISIBLE TAP" changeAfterEvery="5"
source="[CONFIGURATION.photoConfig]" defaultImageResource="default_image"/>
ตัวอย่างก่อนหน้านี้แสดง 2 ตัวเลือกที่แสดงเมื่อใช้ MULTIPLE
- แอตทริบิวต์
change
ช่วยให้นักพัฒนาแอประบุเหตุการณ์ที่ควรทำให้รูปภาพแสดงภาพที่มีอยู่แบบวนซ้ำ
ในตัวอย่างก่อนหน้านี้มีการระบุทั้ง TAP
และ ON_VISIBLE
ซึ่งหมายความว่ารูปภาพจะเปลี่ยนแปลงตามการที่ผู้ใช้แตะรูปภาพหรือการที่รูปภาพปรากฏขึ้น
- แอตทริบิวต์
changeAfterEvery
จะมีผลกับเหตุการณ์การเปลี่ยนแปลง ON_VISIBLE
เท่านั้น โดยระบุจํานวนครั้งที่รูปภาพควรปรากฏขึ้นก่อนที่จะมีการเปลี่ยนแปลงรูปภาพ เช่น คุณอาจรู้สึกว่าการเปลี่ยนรูปภาพทุกครั้งที่ผู้ใช้ปลุกนาฬิกานั้นบ่อยเกินไป ค่าเริ่มต้นที่นี่คือ 3
ดูรายละเอียดเพิ่มเติมเกี่ยวกับการใช้ PhotosConfiguration
ได้ที่ตัวอย่างใน GitHub
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","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-27 UTC"],[],[],null,["# Personalize with photos\n\n**Note**: This feature is available on version 4 and higher of Watch Face\nFormat.\n\nAllowing the user to select photos for inclusion on the watch face can help\nbring a personal touch to your watch face experience.\n\nThe [working with images](/training/wearables/wff/images) section already covers how to display images in\nyour watch face. If you want to allow the user to choose from a range of\npredefined images, then use a `ListConfiguration` as shown in the [define user\nconfigurations](/training/wearables/wff/personalization/user-configurations) section.\n\nTo use images in your watch face that the user can configure, use the\n`\u003cPhotosConfiguration\u003e` element, for example: \n\n \u003cUserConfigurations\u003e\n \u003cPhotosConfiguration id=\"photoConfig\" configType=\"SINGLE\"/\u003e\n \u003c/UserConfigurations\u003e\n\nThe `configType` can be either `SINGLE` or `MULTIPLE` indicating whether the\nuser will be able to select a single image within the companion or a collection\nof photos.\n\nSupport a single photo\n----------------------\n\nFor the single image case, the photo can be used within a `PartImage` element as\nfollows: \n\n \u003cPartImage ...\u003e\n \u003cPhotos source=\"[CONFIGURATION.photoConfig]\" defaultImageResource=\"default_image\"/\u003e\n \u003c/PartImage\u003e\n\nNote the `defaultImageResource`, which is shown when the user has not\nselected a photo in the companion and is a required attribute.\n\nIf the user wishes to select a different photo, then they must use the companion\nto replace the existing selection with another.\n\nSupport multiple photos\n-----------------------\n\nUsing `PhotosConfiguration` with `configType=\"MULTIPLE\"` allows the watch face\nto display a photo from a collection, which can be cycled through either through\ntapping or automatically after so many views have taken place. \n\n \u003cPhotos change=\"ON_VISIBLE TAP\" changeAfterEvery=\"5\"\n source=\"[CONFIGURATION.photoConfig]\" defaultImageResource=\"default_image\"/\u003e\n\nThe preceding example shows the two options that are introduced when using\n`MULTIPLE`:\n\n1. The `change` attribute allows the developer to specify what events should cause the photo to cycle through the available images.\n\nIn the preceding example, both `TAP` and `ON_VISIBLE` are specified, meaning\nthat the photo changes in response *either* to a user tapping the photo *or*\nin response to the photo becoming visible.\n\n1. The `changeAfterEvery` attribute applies only to the `ON_VISIBLE` change event, specifing how many times the photo should have become visible before the photo is changed. For example, you may feel that changing the photo every time the user wakes their watch is too frequent. The default value here is 3.\n\nFor more details on working with `PhotosConfiguration`, see the samples on\nGitHub."]]