dashIntervals is a space-separated series of values that describe the dash
intervals. There must be an even number of dash intervals provided, with the
even indices specifying the "on" intervals, and the odd indices specifying the
"off" intervals.
dashPhase is an offset into the intervals array (mod the sum of all of the
intervals). The default value is 0.
These attributes are used to create a DashPathEffect.
cap
Determine the shape of the edge of the stroke. Supported values are:
BUTT causes the stroke to end with the path, and not project beyond it.
ROUNDcauses the stroke to project out as a semicircle, with the center at
the end of the path.
SQUARE causes the stroke to project out as a square, with the center at
the end of the path.
Inner elements
The Stroke element can contain the following elements:
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-05-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-20 UTC."],[],[],null,["# Stroke\n\nWatch Face Format version Version 4 Version 3 Version 2 Version 1\n\n*** ** * ** ***\n\nA stroke sets the visual style of a line or border.\n\nSyntax\n------\n\n```xml\n\u003cStroke color=\"argb-color\" thickness=\"float\" dashIntervals=\"string\"\n dashPhase=\"string\" cap=\"BUTT | ROUND | SQUARE\" \u003e\n \u003c!-- Only the most common inner element is shown here. --\u003e\n \u003cLinearGradient /\u003e\n ...\n\u003cStroke /\u003e\n```\n\nAttributes\n----------\n\nThe `Stroke` element has the following attributes:\n\n### Required attributes\n\nThe following attributes are required:\n\n`color`\n\n: The color of the stroke. You must specify the color using\n either the ARGB format (`#ff000000` = opaque black) or the RGB format\n (`#000000` = black).\n\n From version 4, this attribute is [transformable](/training/wearables/wff/common/transform/transform).\n\n`thickness`\n\n: The thickness of the stroke expressed as a [float dimension](/training/wearables/wff/common/attributes/dimension-type).\n\n This attribute is [transformable](/training/wearables/wff/common/transform/transform).\n\n### Optional attributes\n\nThe following attributes are optional:\n\n`dashIntervals`, `dashPhase`\n: `dashIntervals` is a space-separated series of values that describe the dash\n intervals. There must be an even number of dash intervals provided, with the\n even indices specifying the \"on\" intervals, and the odd indices specifying the\n \"off\" intervals.\n `dashPhase` is an offset into the intervals array (mod the sum of all of the\n intervals). The default value is 0.\n These attributes are used to create a [`DashPathEffect`](/reference/android/graphics/DashPathEffect).\n\n`cap`\n\n: Determine the shape of the edge of the stroke. Supported values are:\n\n - `BUTT` causes the stroke to end with the path, and not project beyond it.\n - `ROUND`causes the stroke to project out as a semicircle, with the center at the end of the path.\n - `SQUARE` causes the stroke to project out as a square, with the center at the end of the path.\n\nInner elements\n--------------\n\nThe `Stroke` element can contain the following elements:\n\n- [`LinearGradient`](/training/wearables/wff/group/part/draw/gradient/linear-gradient)\n- [`RadialGradient`](/training/wearables/wff/group/part/draw/gradient/radial-gradient)\n- [`SweepGradient`](/training/wearables/wff/group/part/draw/gradient/sweep-gradient)\n- [`Transform`](/training/wearables/wff/common/transform/transform)\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Stroke](/training/wearables/wff/v2/group/part/draw/style/stroke)\n- [Fill](/training/wearables/wff/group/part/draw/style/fill)\n- [WeightedStroke](/training/wearables/wff/group/part/draw/style/weighted-stroke)"]]