ترتيب العناصر في مجموعات
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تتيح لك المجموعات فصل تصميم خلفية شاشة الساعة إلى بنية منطقية.
ويمكن أن يكون ذلك مفيدًا لمساعدتك في تنظيم المكوّنات. يمكنك منح كل
مجموعة name
للإشارة إلى الغرض منها.
ومن الأسباب الأخرى التي تجعل المجموعات مفيدة جدًا أنّه يمكنك بعد ذلك التعامل مع كل ما في تلك المجموعة ككيان واحد بغرض تعديل شكله، حتى مع التعديل الديناميكي لمصادر البيانات المتغيّرة.
في ما يلي بعض الأمثلة على مدى فائدة ذلك. يحتوي Group
التالي على
عناصر PartText, PartImage
وPartDraw
مختلفة تشكل
جزءًا منطقيًا واحدًا من خلفية شاشة الساعة:
<Group name="decorations" ...>
<PartText ...>
<PartImage ...>
<PartDraw ...>
</Group>
تغيير سلوك الإضاءة السينمائية
بعد تحديد Group
، يمكن ضبط مستوى رؤية Group
بالكامل
في "وضع الإضاءة السينمائية"، على سبيل المثال، لإخفاء Group
:
<Group ...>
<Variant mode="AMBIENT" target="alpha" value="0" />
<PartText ...>
<PartImage ...>
<PartDraw ...>
</Group>
ويؤدي ذلك إلى تجنُّب الحاجة إلى إضافة عنصر Variant
بشكلٍ فردي إلى كل عنصر
فرعي.
على غرار ضبط السلوك المحيط، باستخدام Variant
، يمكن ضبط العديد من
خصائص Group
باستخدام عنصر Transform
واحد أو أكثر.
في هذا المثال، يتم تدوير الرمز Group
استنادًا إلى الرمز الثاني. من خلال تحديد
pivotX
وpivotY
على أنّهما 0.5
، يحدث الدوران حول مركز
Group
، بغض النظر عن موضع كل عنصر، مثل PartText
أو PartImage
داخل هذا Group
:
<Group x="0" y="0" width="450" height="450" pivotX="0.5" pivotY="0.5">
<!-- One full rotation per minute -->
<Transform target="angle" value="[SECOND] * 6" />
<PartText ...>
<PartImage ...>
<PartDraw ...>
</Group>
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Arrange elements into groups\n\nGroups allow you to separate your watch face design into a logical structure.\n\nThis can be useful to help you organize components. You can give each\ngroup a `name` to indicate what it is for.\n\nA further reason that groups are very useful is that you can then treat\neverything within that group as a single entity for the purpose of adjusting its\nappearance, even dynamically adjusting to changing data sources.\n\nHere are some examples of how this can be useful. The following `Group` contains\nvarious `PartText, PartImage` and `PartDraw` elements that make up a single\nlogical part of the watch face: \n\n \u003cGroup name=\"decorations\" ...\u003e\n \u003cPartText ...\u003e\n \u003cPartImage ...\u003e\n \u003cPartDraw ...\u003e\n \u003c/Group\u003e\n\nChange ambient behavior\n-----------------------\n\nHaving defined the `Group`, the visibility of the whole `Group` can be adjusted\nfor Ambient mode, for example, to hide the `Group`: \n\n \u003cGroup ...\u003e\n \u003cVariant mode=\"AMBIENT\" target=\"alpha\" value=\"0\" /\u003e\n \u003cPartText ...\u003e\n \u003cPartImage ...\u003e\n \u003cPartDraw ...\u003e\n \u003c/Group\u003e\n\nThis avoids the need to add a `Variant` element individually to each child\nelement.\n\n### Transform a group\n\nSimilar to adjusting the ambient behavior, using `Variant`, many of the\nproperties of `Group` can be adjusted using one or more `Transform` elements.\n\nIn this example, the `Group` is rotated based on the second. By specifying\n`pivotX` and `pivotY` as `0.5`, the rotation occurs around the center of the\n`Group`, irrespective of where each element, such as `PartText` or `PartImage`\nsits within that `Group`: \n\n \u003cGroup x=\"0\" y=\"0\" width=\"450\" height=\"450\" pivotX=\"0.5\" pivotY=\"0.5\"\u003e\n \u003c!-- One full rotation per minute --\u003e\n \u003cTransform target=\"angle\" value=\"[SECOND] * 6\" /\u003e\n \u003cPartText ...\u003e\n \u003cPartImage ...\u003e\n \u003cPartDraw ...\u003e\n \u003c/Group\u003e"]]