Stroke

A stroke sets the visual style of a line or border.

Syntax

<Stroke color="argb-color" thickness="float" dashIntervals="string"
           dashPhase="string" cap="BUTT | ROUND | SQUARE" >
    <!-- Only the most common inner element is shown here. -->
  <LinearGradient />
  ...
<Stroke />

Attributes

The Stroke element has the following attributes:

Required attributes

The following attributes are required:

color
The color of the stroke. You must specify the color using either the ARGB format (#ff000000 = opaque black) or the RGB format (#000000 = black).
thickness

The thickness of the stroke expressed as a float dimension.

This attribute is transformable.

Optional attributes

The following attributes are optional:

dashIntervals, dashPhase
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: