요소를 그룹으로 정렬
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
그룹을 사용하면 시계 화면 디자인을 논리적 구조로 구분할 수 있습니다.
이는 구성요소를 구성하는 데 유용할 수 있습니다. 각 그룹에 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
로 지정하면 PartText
또는 PartImage
와 같은 각 요소가 Group
내에서 어디에 있는지에 관계없이 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>
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],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"]]