Litho provides extensive support for stylized borders on component layouts. All of the available options are specified through a Border object via a builder pattern.
Litho supports setting a border width for all edges, or a different width per edge. Specifying a width for a certain edge is done via the various width builder methods.
For example, let's say you wanted to specify a 10 dip border width for all edges:
Row.create(c)
.child(
Text.create(c)
.text("Hello Litho")
.textSizeSp(16))
.border(
Border.create(c)
.widthDip(YogaEdge.ALL,5)
.color(YogaEdge.ALL,0xfff36b7f)
.build())
.build()
Or that you'd like to specify specific widths for a specific edge:
Under the hood, each effect utilizes a standard PathEffect supplied by the Android Framework. You may use up to two effects at the same time. If you use two effects, they will both be composed with each other in the order given.
Border effects are specified via the various *Effect methods on the Border.Builder object.
IMPORTANT
Currently Litho does not support varying border widths with effects. Each border width must be the same.
The discrete effect will divide your border into segments whereby each segment will randomly deviate in the cross axis. This effect utilizes DiscretePathEffect internally.
Row.create(c)
.child(
Text.create(c)
.text("Hello Litho")
.textSizeSp(16))
.border(
Border.create(c)
.widthDip(YogaEdge.ALL,5)
.color(YogaEdge.ALL,0xfff36b7f)
// We set a segment length of 10 with a maximum deviation of 5
Path dash will take in a custom Android path object and continually stamp the path along the border. This effect utilizes PathDashPathEffect internally.