小工具邊界區域


小工具邊界區域可用來定義小工具的顯示區域。錶面編輯器會顯示邊界區域的外框。超出邊界區域的所有內容都會遭到裁切。

邊界區域也會決定使用者可從錶面選取小工具的範圍。

這項元素已在 Wear OS 4 推出。

BoundingBox

BoundingBox 元素會定義小工具的矩形邊界區域。

語法

<BoundingBox x="integer" y="integer" width="integer" height="integer"
                outlinePadding="float" />

屬性

BoundingBox 元素的屬性如下:

必要屬性

必要屬性包括:

xywidthheight
這是一組指定元素大小和位置的整數。

選用屬性

選用屬性包括:

outlinePadding
指定邊界區域外的邊框間距浮點值。可用來在錶面編輯器中建立較大的外框。預設為 0。

BoundingRoundBox

BoundingRoundBox 元素會定義小工具的圓角矩形邊界區域。

語法

<BoundingRoundBox x="integer" y="integer" width="integer" height="integer"
                outlinePadding="float" cornerRadius="float" />

屬性

BoundingRoundBox 元素的屬性如下:

必要屬性

必要屬性包括:

xywidthheight
這是一組指定元素大小和位置的整數。

選用屬性

選用屬性包括:

cornerRadius

圓形的半徑。這個值會定義矩形圓角的程度。

outlinePadding
指定邊界區域外的邊框間距浮點值。可用來在錶面編輯器中建立較大的外框。預設為 0。

BoundingOval

BoundingOval 元素會定義小工具的圓形邊界區域。

語法

<BoundingOval x="integer" y="integer" width="integer" height="integer"
                outlinePadding="float" />

屬性

BoundingOval 元素的屬性如下:

必要屬性

必要屬性包括:

xywidthheight
這是一組指定元素大小和位置的整數。

選用屬性

選用屬性包括:

outlinePadding
指定邊界區域外的邊框間距浮點值。可用來在錶面編輯器中建立較大的外框。預設為 0。

BoundingArc

BoundingArc 元素會定義小工具的弧形邊界區域。

語法

<BoundingArc centerX="float" centerY="float" width="float"
                height="float" thickness="float" isRoundEdge="boolean"
                startAngle="float" endAngle="float"
                direction="CLOCKWISE | COUNTER_CLOCKWISE"
                outlinePadding="float" />

屬性

BoundingArc 元素的屬性如下:

必要屬性

必要屬性包括:

centerXcenterYwidthheight
一組定義弧形所包含橢圓形的屬性。弧形會縮放至符合所指定橢圓形的內部。所有屬性都會以浮點值的形式定義。
thickness
弧形的粗細,以浮點值表示。
startAngle
弧形的起始角度,以度為單位。0 度角會對應至手錶的 12 點鐘位置。
endAngle
弧形的結束角度。

選用屬性

選用屬性包括:

isRoundEdge
決定弧線末端是平角或圓角。預設值為 FALSE。
direction
弧形的旋轉方向。預設為 CLOCKWISE
outlinePadding
指定邊界區域外的邊框間距浮點值。可用來在錶面編輯器中建立較大的外框。預設為 0。