PartText

此元素代表錶面中只有一個文字版面配置元素的部分。

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

語法

<PartText x="integer" y="integer" width="integer" height="integer"
           pivotX="float" pivotY="float" angle="float-degrees" alpha="integer"
           name="string" scaleX="float" scaleY="float"
           renderMode="[SOURCE | MASK | ALL]"
           tintColor="argb-color | rgb-color">
    <!-- Text-specific child elements. -->
    <Text>
        <!-- There must be raw text as the leaf inner element within a
            "PartText" element tree. -->
        <Font family="font" size="20" color="#00FFFF">Hello world
        </Font>
        <Font>
            <!-- Example of a text decoration element. -->
            <Outline>
                <!-- Example of a template with 2 string values. -->
                <Template>%s %s
                    <Parameter expression="[MONTH_S]" />
                    <Parameter expression="[DAY]" />
                </Template>
            </Outline>
            <!-- Example of a text formatting element. -->
            <Upper>
                <Template ... />
            </Upper>
            <Template ... />
        </Font>
    </Text>
    <!-- A "PartText" element can contain this "TextCircular" element instead
         of a "Text" element. -->
    <TextCircular centerX="180" centerY="180" direction="COUNTER_CLOCKWISE"
                  endAngle="90" height="340" width="340" startAngle="270">
        There must be raw text as the leaf inner element within a "PartText"
        element tree.
        <Font family="font" size="20" color="#00FFFF">Hello world
        </Font>
        <Font>
            Example of a text decoration element.
            <Outline>
                Example of a template with 2 string values.
                <Template>%s %s
                    <Parameter expression="[MONTH_S]" />
                    <Parameter expression="[DAY]" />
                </Template>
            </Outline>
            Example of a text formatting element.
            <Upper>
                <Template ... />
            </Upper>
            <Template ... />
        </Font>
    </TextCircular />
    -->

    <!-- Child elements that are shared across all "Part" elements. -->
    <Localization .../>
    <Transform .../>
    <Variant .../>
    <Gyro .../>
    <Launch .../>
    <ScreenReader .../>
</PartText>

屬性

PartText 元素的屬性如下:

必要屬性

必要屬性包括:

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

選用屬性

選用屬性包括:

pivotXpivotY
與元素旋轉方向相關的 2D 樞紐點。兩個值都是浮點數,可在 $ [0, 1] $ 範圍內視需求調整。
angle
元素應以順時針方向從樞紐點旋轉的角度數值。
alpha
此屬性可設定元素應具備的透明度。如果值為 0,表示元素應完全透明;值為 255 表示元素應完全不透明。
name
這是用於識別此元素的字串。如果您需要從錶面檔案的其他位置參照這個元素,此屬性就能派上用場。
scaleX
要套用至此元素的水平縮放比例係數。
scaleY
要套用至此元素的垂直縮放比例係數。
renderMode
元素的算繪模式類型。可能的值包括:SOURCE (預設值)、MASKALL
tintColor
為元素套用色調顏色濾鏡。您必須使用 ARGB 格式 (#ff000000 = 不透明黑) 或 RGB 格式 (#000000 = 黑) 指定顏色。

內部元素

PartText 元素可包含下列內部元素。TextTextCircular 為必要元素,其他則全為選用元素。一個 PartText 元素可包含任意數量的個別內部元素,但 TextTextCircularLocalizationGyroLaunchScreenReader 例外,這些元素最多只能出現 1 次。