public class SurfaceRow
- Object
- SurfaceNode
- SurfaceContainer
- 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
Inherited methods
Constructor details
SurfaceRow
public SurfaceRow()Method details
setSpacing
public SurfaceRow setSpacing(int spacing)Sets the horizontal gap between consecutive children.
Parameters
spacingint- 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
childSurfaceNode- the node to append
Returns
this container, for chaining
setPadding
public SurfaceRow setPadding(int all)Sets the same padding on all four sides.
Parameters
allint- 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
topint- top padding in dips
rightint- right padding in dips
bottomint- bottom padding in dips
leftint- left padding in dips
Returns
this node, for chaining
setBackground
public SurfaceRow setBackground(SurfaceColor color)Sets the background color of this node.
Parameters
colorSurfaceColor- 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
radiusint- 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
alignmentSurfaceAlignment- 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
weightint- 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
widthDipsint- fixed width in dips, 0 for natural width
heightDipsint- 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
actionIdString- 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
actionIdString- the app-defined action identifier
paramsMap<String, Object>- parameters delivered with the action, may be null
Returns
this node, for chaining