# Class SurfaceRow

java.lang.Object
com.codename1.surfaces.SurfaceNode
com.codename1.surfaces.SurfaceContainer
com.codename1.surfaces.SurfaceRow

public class SurfaceRow extends SurfaceContainer
A container that lays its children out horizontally. Maps to a SwiftUI `HStack`, an Android horizontal `LinearLayout` and a horizontal box on desktop surfaces.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SurfaceRow()`

- ## Method Summary

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

  ### Methods inherited from class SurfaceContainer

  `getChildren`

  ### Methods inherited from class SurfaceNode

  `getActionId, getActionParams, getAlignment, getBackground, getCornerRadius, getHeightDips, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getWeight, getWidthDips`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SurfaceRow

    public SurfaceRow()

- ## Method Details

  - ### setSpacing

    public SurfaceRow setSpacing(int spacing)

    Sets the horizontal gap between consecutive children.

    ###### Parameters

    - `spacing`: 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)
    Description copied from class: `SurfaceContainer`

    Adds a child node.

    ###### Parameters

    - `child`: the node to append

    ###### Returns

    this container, for chaining

    Overrides:
      `add` in class `SurfaceContainer`

  - ### setPadding

    public SurfaceRow setPadding(int all)
    Description copied from class: `SurfaceNode`

    Sets the same padding on all four sides.

    ###### Parameters

    - `all`: padding in dips

    ###### Returns

    this node, for chaining

    Overrides:
      `setPadding` in class `SurfaceNode`

  - ### setPadding

    public SurfaceRow setPadding(int top, int right, int bottom, int left)
    Description copied from class: `SurfaceNode`

    Sets the padding of each side individually.

    ###### Parameters

    - `top`: top padding in dips
    - `right`: right padding in dips
    - `bottom`: bottom padding in dips
    - `left`: left padding in dips

    ###### Returns

    this node, for chaining

    Overrides:
      `setPadding` in class `SurfaceNode`

  - ### setBackground

    public SurfaceRow setBackground(SurfaceColor color)
    Description copied from class: `SurfaceNode`

    Sets the background color of this node.

    ###### Parameters

    - `color`: the background color

    ###### Returns

    this node, for chaining

    Overrides:
      `setBackground` in class `SurfaceNode`

  - ### setCornerRadius

    public SurfaceRow setCornerRadius(int radius)
    Description copied from class: `SurfaceNode`

    Sets the corner radius applied to the node's background. May render square on Android versions below 12.

    ###### Parameters

    - `radius`: the corner radius in dips

    ###### Returns

    this node, for chaining

    Overrides:
      `setCornerRadius` in class `SurfaceNode`

  - ### setAlignment

    public SurfaceRow setAlignment(SurfaceAlignment alignment)
    Description copied from class: `SurfaceNode`

    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`: the alignment

    ###### Returns

    this node, for chaining

    Overrides:
      `setAlignment` in class `SurfaceNode`

  - ### setWeight

    public SurfaceRow setWeight(int weight)
    Description copied from class: `SurfaceNode`

    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`: the relative weight, 0 for natural sizing

    ###### Returns

    this node, for chaining

    Overrides:
      `setWeight` in class `SurfaceNode`

  - ### setSize

    public SurfaceRow setSize(int widthDips, int heightDips)
    Description copied from class: `SurfaceNode`

    Sets a fixed size for this node. A value of 0 (the default) keeps the natural size of the respective axis.

    ###### Parameters

    - `widthDips`: fixed width in dips, 0 for natural width
    - `heightDips`: fixed height in dips, 0 for natural height

    ###### Returns

    this node, for chaining

    Overrides:
      `setSize` in class `SurfaceNode`

  - ### setAction

    public SurfaceRow setAction(String actionId)
    Description copied from class: `SurfaceNode`

    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`: the app-defined action identifier

    ###### Returns

    this node, for chaining

    Overrides:
      `setAction` in class `SurfaceNode`

  - ### setAction

    public SurfaceRow setAction(String actionId, Map<String,Object> params)
    Description copied from class: `SurfaceNode`

    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`: the app-defined action identifier
    - `params`: parameters delivered with the action, may be null

    ###### Returns

    this node, for chaining

    Overrides:
      `setAction` in class `SurfaceNode`