Provides comparison logic for conditionally enabling the appearance, animation, and event handling of child elements.
Introduced in Wear OS 4.
Syntax
<Condition> <!-- The "Expressions" element is required. --> <Expressions> <Expression name="unique-name"> <!-- Arithmetic expression goes here. --> </Expression> <!-- Other expressions go here. --> </Expressions> <!-- The "expression" attribute is required. --> <Compare expression="expression-name"> <!-- ONE of the following only: --> <Group ... /> <PartText ... /> <PartImage ... /> <PartAnimatedImage ... /> <PartDraw ... /> <Condition ... /> <AnalogClock ... /> <DigitalClock ... /> </Compare> <!-- The "else" case for when all of the above "Compar e" conditions are false. --> <Default> <!-- ONE of the following only: --> <Group ... /> <PartText ... /> <PartImage ... /> <PartAnimatedImage ... /> <PartDraw ... /> <Condition ... /> <AnalogClock ... /> <DigitalClock ... /> </Default> </Condition>
Inner elements
The Condition
element contains the following inner elements:
Expressions
Defines a set of
Expression
elements that each have aname
attribute and contain an arithmetic expression. Thename
must be globally unique.A
Condition
element must contain at least oneExpressions
element.Compare
Contains a single element tree that is visible, animated, and receptive to events only if the expression with the given name evaluates to
true
or a non-zero value. Thename
attribute must match thename
attribute of anExpression
element used elsewhere in theCondition
element.Default
Contains a single element tree that is visible, animated, and receptive to events only when none of the
Compare
element groups are activated.
Recommended for you
- Note: link text is displayed when JavaScript is off
- Group
- SourceType
- ArithmeticExpression