קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
רכיב הוא כל תכונה שמוצגת בתצוגת השעון בנוסף לשעה.
לדוגמה, אינדיקטור של סוללה הוא סיבוך. Complications API מיועד גם לתצוגות שעון וגם לאפליקציות של מקורות נתונים.
בהמשך המסמך מתוארים מקורות הנתונים, תצוגות השעון
וסוגי רכיבים.
מקור הנתונים של הסיבוך
אפליקציות שמספקות נתונים כמו רמת הטעינה של הסוללה, מזג האוויר או מספר הצעדים לתצוגות השעון עם התכונה 'סמל מידע' נקראות מקורות נתונים של סמלי מידע. מקורות הנתונים האלה
מספקים נתונים גולמיים
והם לא אחראים לקבוע את אופן עיבוד הנתונים שלהם
בתצוגת השעון.
למידע נוסף על כתיבת אפליקציות שמספקות נתונים לתצוגות השעון, אפשר לעיין במאמר
חשיפת נתונים
לרכיבים.
בתרשים הבא אפשר לראות איך Wear OS by Google מתווכת את זרימת הנתונים ממקורות אל תצוגות השעון.
איור 1. תהליך העברת הנתונים של הרכיבים.
תכונות נוספות בתצוגות השעון
חזיתות השעון מקבלות נתונים ממקורות נתונים של רכיבים, וכך אפשר לכלול רכיבים בלי צורך בקוד לקבלת הנתונים הבסיסיים. אתם יכולים לשלוט באופן שבו הנתונים יוצגו במסך השעון, כדי לשלב אותם באופן טבעי בעיצוב של המסך. מידע נוסף זמין במדריך העיצוב בנושא סמלי שעון.
סוגי הנתונים מגדירים
אילו סוגי נתונים יכולים להופיע ברכיב
או לקבל על ידי
מקור נתונים. לדוגמה, כדאי להשתמש בסוג SHORT_TEXT כשהנתונים מורכבים בעיקר ממחרונית קצרה. לכל אובייקט ComplicationData יש תמיד סוג אחד של רכיב מותאם אישית שמגדיר את השדות הנדרשים והאופציונליים. שדה נדרש מייצג את הנתון הראשי. רוב הסוגים מקבלים את השם שלהם מהשדה הנדרש.
מקורות הנתונים משתמשים בסוגים שונים של סמלי 'תצוגת מידע', בניגוד לשעונים:
מקור הנתונים בוחר את סוגי הנתונים של התוסף שיסופקו, כולל השדות האופציונליים של סוגי הנתונים האלה שיסופקו, ומספר הסוגים השונים שאפשר לתמוך בהם. למשל, מקור של ספירת שלבים עשוי לתמוך בסוגים RANGED_VALUE ו-SHORT_TEXT, ומקור של פגישה הבאה עשוי לתמוך בסוגים SHORT_TEXT ו-LONG_TEXT.
אתם יכולים לבחור כמה תכונות נוספות לכלול בתצוגת השעון ואת סוגי התכונות הנוספות שתומכים בהם. לדוגמה, רכיב נוסף של שעון בתצוגת השעון יכול לתמוך בסוגי SHORT_TEXT, ICON ו-RANGED_VALUE.
יכול להיות שמד בחזית השעון יתמוך רק בסוג RANGED_VALUE.
למידע נוסף על הסוגים השונים של הרכיבים והשדות שנתמכים בכל סוג, אפשר לעיין במאמר
סוגי הרכיבים.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. 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,["# About complications\n\nA\n[complication](https://en.wikipedia.org/wiki/Complication_(horology))\nis any feature that is displayed on a watch face in addition to the time.\nFor example, a battery\nindicator is a complication. The\n[Complications API](/reference/kotlin/androidx/wear/watchface/complications/package-summary)\nis for both watch faces and data source apps.\n\n\nThe rest of this document describes data sources, watch faces, and\ncomplication types.\n\nComplication data source\n------------------------\n\nApps that provide data such as\nbattery level, weather, or step counts to watch faces for\ncomplications are called *complication data sources* . These data\nsources supply raw data\nand are not responsible for controlling how their data is rendered on a\nwatch face.\nTo learn about writing apps that provide data to watch faces, see\n[Expose data to\ncomplications](/training/wearables/exposing-data-complications).\n\nThe following diagram shows how Wear OS by Google mediates the flow of data\nfrom sources to watch faces.\n**Figure 1.** The flow of complication data.\n\nComplications on watch faces\n----------------------------\n\nWatch faces receive data from complication data sources, which lets them\ninclude\ncomplications without needing code for getting the underlying data. Watch\nfaces retain\ncontrol over how the data is rendered, so they can integrate data\nnaturally with their\ndesign. For more information, see the design guide about\n[Complications](/training/wearables/design/complications).\n\nTo learn how to add complications to a watch face, see\n[Add complications to a watch face](/training/wearables/watch-faces/adding-complications).\n\nComplication types\n------------------\n\nComplication types define what kinds of data can be shown in a\ncomplication or supplied by\na data source. For example, use the `SHORT_TEXT` type when the\ndata consists\nprimarily of a short string. A\n[`ComplicationData`](/reference/androidx/wear/watchface/complications/data/ComplicationData) object always has a single\ncomplication type that defines required and optional fields. A required\nfield\nrepresents the primary piece of data; most types take their name from\nthe required field.\n\nData sources use complication types differently from watch faces:\n\n- A data source chooses the types of complication data to supply, including which optional fields of those types to supply, and how many different types can be supported. For example, a step-count source might support the `RANGED_VALUE` and `SHORT_TEXT` types, and a next-meeting source might support the `SHORT_TEXT` and `LONG_TEXT` types.\n- You can choose how many complications to include in your watch face and the complication types to support. For example, a dial complication on a watch face might support the `SHORT_TEXT`, `ICON`, and `RANGED_VALUE` types. A gauge on the watch face might support only the `RANGED_VALUE` type.\n\nTo learn more about different complication types and fields supported by\neach type, see\n[Complication types](/training/wearables/watch-faces/adding-complications#types-fields)."]]