public class SurfaceColumn

  1. Object
  2. SurfaceNode
  3. SurfaceContainer
  4. SurfaceColumn
A container that stacks its children vertically. Maps to a SwiftUI VStack, an Android vertical LinearLayout and a vertical box on desktop surfaces.

Constructors

public SurfaceColumn()

Methods

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

Inherited methods

Constructor details

SurfaceColumn

public SurfaceColumn()

Method details

setSpacing

public SurfaceColumn setSpacing(int spacing)
Sets the vertical gap between consecutive children.

Parameters

spacing int
the gap in dips

Returns

this column, for chaining

getSpacing

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

add

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

Parameters

child SurfaceNode
the node to append

Returns

this container, for chaining

setPadding

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

Parameters

all int
padding in dips

Returns

this node, for chaining

setPadding

public SurfaceColumn 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 SurfaceColumn setBackground(SurfaceColor color)
Sets the background color of this node.

Parameters

color SurfaceColor
the background color

Returns

this node, for chaining

setCornerRadius

public SurfaceColumn 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 SurfaceColumn 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 SurfaceColumn 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 SurfaceColumn 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 SurfaceColumn 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 SurfaceColumn 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