public class SurfaceRow

  1. Object
  2. SurfaceNode
  3. SurfaceContainer
  4. SurfaceRow
A container that lays its children out horizontally. Maps to a SwiftUI HStack, an Android horizontal LinearLayout and a horizontal box on desktop surfaces.

Constructors

public SurfaceRow()

Methods

public SurfaceRow setSpacing(int spacing)Sets the horizontal gap between consecutive children.
public int getSpacing()Returns the gap between consecutive children in dips.
public SurfaceRow add(SurfaceNode child)Adds a child node.
public SurfaceRow setPadding(int all)Sets the same padding on all four sides.
public SurfaceRow setPadding(int top, int right, int bottom, int left)Sets the padding of each side individually.
public SurfaceRow setBackground(SurfaceColor color)Sets the background color of this node.
public SurfaceRow setCornerRadius(int radius)Sets the corner radius applied to the node’s background.
public SurfaceRow setAlignment(SurfaceAlignment alignment)Sets this node’s alignment within its parent.
public SurfaceRow setWeight(int weight)Sets the flexible-space weight of this node within a row or column.
public SurfaceRow setSize(int widthDips, int heightDips)Sets a fixed size for this node.
public SurfaceRow setAction(String actionId)Assigns a tap action to this node.
public SurfaceRow setAction(String actionId, Map<String, Object> params)Assigns a tap action with parameters to this node.

Inherited methods

Constructor details

SurfaceRow

public SurfaceRow()

Method details

setSpacing

public SurfaceRow setSpacing(int spacing)
Sets the horizontal gap between consecutive children.

Parameters

spacing int
the gap in dips

Returns

this row, for chaining

getSpacing

public int getSpacing()
Returns the gap between consecutive children in dips.

add

public SurfaceRow add(SurfaceNode child)
Adds a child node.

Parameters

child SurfaceNode
the node to append

Returns

this container, for chaining

setPadding

public SurfaceRow setPadding(int all)
Sets the same padding on all four sides.

Parameters

all int
padding in dips

Returns

this node, for chaining

setPadding

public SurfaceRow setPadding(int top, int right, int bottom, int left)
Sets the padding of each side individually.

Parameters

top int
top padding in dips
right int
right padding in dips
bottom int
bottom padding in dips
left int
left padding in dips

Returns

this node, for chaining

setBackground

public SurfaceRow setBackground(SurfaceColor color)
Sets the background color of this node.

Parameters

color SurfaceColor
the background color

Returns

this node, for chaining

setCornerRadius

public SurfaceRow setCornerRadius(int radius)
Sets the corner radius applied to the node’s background. May render square on Android versions below 12.

Parameters

radius int
the corner radius in dips

Returns

this node, for chaining

setAlignment

public SurfaceRow setAlignment(SurfaceAlignment alignment)
Sets this node’s alignment within its parent. In a SurfaceBox all nine positions apply; in rows and columns only the cross-axis component is used.

Parameters

alignment SurfaceAlignment
the alignment

Returns

this node, for chaining

setWeight

public SurfaceRow setWeight(int weight)
Sets the flexible-space weight of this node within a row or column. Nodes with a weight share the leftover space of the parent proportionally; a weight of 0 (the default) sizes the node to its natural size.

Parameters

weight int
the relative weight, 0 for natural sizing

Returns

this node, for chaining

setSize

public SurfaceRow setSize(int widthDips, int heightDips)
Sets a fixed size for this node. A value of 0 (the default) keeps the natural size of the respective axis.

Parameters

widthDips int
fixed width in dips, 0 for natural width
heightDips int
fixed height in dips, 0 for natural height

Returns

this node, for chaining

setAction

public SurfaceRow setAction(String actionId)
Assigns a tap action to this node. Tapping the node opens (or foregrounds) the app and delivers the action id to the handler registered with Surfaces.setActionHandler(...). Note that small iOS home-screen widgets only honor the action of the root node.

Parameters

actionId String
the app-defined action identifier

Returns

this node, for chaining

setAction

public SurfaceRow setAction(String actionId, Map<String, Object> params)
Assigns a tap action with parameters to this node. The parameter map may contain String, Number and Boolean values and is delivered verbatim with the SurfaceActionEvent.

Parameters

actionId String
the app-defined action identifier
params Map<String, Object>
parameters delivered with the action, may be null

Returns

this node, for chaining