public abstract class SurfaceNode
- Object
- SurfaceNode
Known subtypesSurfaceContainer, SurfaceDynamicText, SurfaceImage, SurfaceProgress, SurfaceSpacer, SurfaceText, SurfaceVector
The base class of all surface layout nodes. A surface descriptor is a small tree of nodes
(columns, rows, boxes, text, images, progress indicators) that every platform can render
natively while the app process is not running – so a node is pure data: there are no
listeners, no theme lookups and no live Image references in the serialized form.
All nodes share the styling in this class: padding, background color, corner radius, alignment
within the parent, flexible weight, an optional fixed size and an optional action. An action is
a plain string id (plus optional parameters) delivered to the handler registered with
Surfaces.setActionHandler(...) when the user taps the node – see SurfaceActionEvent.
All dimensions are in display-independent pixels (dips).
Constructors
public SurfaceNode() |
Methods
Inherited methods
Constructor details
SurfaceNode
public SurfaceNode()Method details
setPadding
public SurfaceNode setPadding(int all)Parameters
allint- padding in dips
Returns
setPadding
public SurfaceNode setPadding(int top, int right, int bottom, int left)Parameters
topint- top padding in dips
rightint- right padding in dips
bottomint- bottom padding in dips
leftint- left padding in dips
Returns
setBackground
public SurfaceNode setBackground(SurfaceColor color)Parameters
colorSurfaceColor- the background color
Returns
setCornerRadius
public SurfaceNode setCornerRadius(int radius)Parameters
radiusint- the corner radius in dips
Returns
setAlignment
public SurfaceNode setAlignment(SurfaceAlignment alignment)SurfaceBox all nine positions apply;
in rows and columns only the cross-axis component is used.Parameters
alignmentSurfaceAlignment- the alignment
Returns
setWeight
public SurfaceNode setWeight(int weight)Parameters
weightint- the relative weight, 0 for natural sizing
Returns
setSize
public SurfaceNode setSize(int widthDips, int heightDips)Parameters
widthDipsint- fixed width in dips, 0 for natural width
heightDipsint- fixed height in dips, 0 for natural height
Returns
setAction
public SurfaceNode setAction(String actionId)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
setAction
public SurfaceNode setAction(String actionId, Map<String, Object> params)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
getPaddingTop
public int getPaddingTop()getPaddingRight
public int getPaddingRight()getPaddingBottom
public int getPaddingBottom()getPaddingLeft
public int getPaddingLeft()getBackground
public SurfaceColor getBackground()getCornerRadius
public int getCornerRadius()getAlignment
public SurfaceAlignment getAlignment()getWeight
public int getWeight()getWidthDips
public int getWidthDips()getHeightDips
public int getHeightDips()getActionId
public String getActionId()getActionParams
public Map<String, Object> getActionParams()