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 "Compare" 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:
ExpressionsDefines a set of
Expressionelements that each have anameattribute and contain an arithmetic expression. Thenamemust be unique within the containingConditionelement.A
Conditionelement must contain at least oneExpressionselement.CompareContains a single element tree that is visible, animated, and receptive to events only if the expression with the given name evaluates to
trueor a non-zero value. Thenameattribute must match thenameattribute of anExpressionelement used elsewhere in theConditionelement.DefaultContains a single element tree that is visible, animated, and receptive to events only when none of the
Compareelement groups are activated.
Recommended for you
- Note: link text is displayed when JavaScript is off
- AGSL Quick Reference
- Define data using Room entities
- Data Binding in Android