public class Flow extends VirtualLayout


Implements the Flow virtual layout.

Summary

Constants

static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int

Public constructors

Public methods

void
addToSolver(LinearSystem system, boolean optimize)

Add this widget to the solver

void
float
void
measure(int widthMode, int widthSize, int heightMode, int heightSize)
void
void
void
setFirstVerticalBias(float value)
void
void
setHorizontalAlign(int value)
void
setHorizontalBias(float value)
void
setHorizontalGap(int value)
void
setHorizontalStyle(int value)
void
setLastHorizontalBias(float value)
void
void
setLastVerticalBias(float value)
void
void
setMaxElementsWrap(int value)
void
setOrientation(int value)
void
setVerticalAlign(int value)
void
setVerticalBias(float value)
void
setVerticalGap(int value)
void
setVerticalStyle(int value)
void
setWrapMode(int value)

Inherited Constants

From androidx.constraintlayout.core.widgets.ConstraintWidget
static final int
static final int
static final int
static final int
static final int
static final int
BOTH = 2
static final int
static final int
static final int
static final int
DIRECT = 2
static final int
GONE = 8
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
SOLVER = 1
static final int
UNKNOWN = -1
static final int
static final int
static final int
static final int
static final int
static final int

Inherited methods

From androidx.constraintlayout.core.widgets.ConstraintWidget
void
addChildrenToSolverByDependency(
    ConstraintWidgetContainer container,
    LinearSystem system,
    HashSet<ConstraintWidget> widgets,
    int orientation,
    boolean addSelf
)
boolean

Returns true if this widget should be used in a barrier

void
connect(
    ConstraintAnchor.Type constraintFrom,
    ConstraintWidget target,
    ConstraintAnchor.Type constraintTo
)

Connect a given anchor of this widget to another anchor of a target widget

void
connect(ConstraintAnchor from, ConstraintAnchor to, int margin)

Connect the given anchors together (the from anchor should be owned by this widget)

void
connect(
    ConstraintAnchor.Type constraintFrom,
    ConstraintWidget target,
    ConstraintAnchor.Type constraintTo,
    int margin
)

Connect a given anchor of this widget to another anchor of a target widget

void
connectCircularConstraint(
    ConstraintWidget target,
    float angle,
    int radius
)

Set a circular constraint

void

Create all the system variables for this widget

void
void
ConstraintAnchor

Given a type of anchor, returns the corresponding anchor.

ArrayList<ConstraintAnchor>

Return the array of anchors of this widget

int

Return the baseline distance relative to the top of the widget

float
getBiasPercent(int orientation)

Return the percentage bias that is used when two opposite connections exist of the same strength in a particular orientation.

int

Return the bottom position of the widget

Object

Return the companion widget.

int

Accessor for the skip value

String

Returns the name of this widget (used for debug purposes)

ConstraintWidget.DimensionBehaviour
getDimensionBehaviour(int orientation)

Get the widget's DimensionBehaviour in an specific orientation.

float

Return the current ratio of this widget

int

Return the current side on which ratio will be applied

boolean
int

Return the height of the widget

float

Return the horizontal percentage bias that is used when two opposite connections exist of the same strength.

ConstraintWidget

if in a horizontal chain return the left most widget in the chain.

int

get the chain starting from this widget to be packed.

ConstraintWidget.DimensionBehaviour

Accessor for the horizontal dimension behaviour

int

Returns all the horizontal margin of the widget.

int
int
int

Return the left position of the widget (similar to getX)

int
getLength(int orientation)

Get a dimension of the widget in a particular orientation.

int
int
int

Return the minimum height of the widget

int

Return the minimum width of the widget

ConstraintWidget
getNextChainMember(int orientation)

Return the next chain member if one exists

int
int
ConstraintWidget

Returns the parent of this widget if there is one

ConstraintWidget
getPreviousChainMember(int orientation)

Return the previous chain member if one exists

int

Return the right position of the widget

int

Return the x position of the widget, relative to the root (without animation)

int

Return the y position of the widget, relative to the root (without animation)

WidgetRun
getRun(int orientation)
void
int

Return the top position of the widget (similar to getY)

String

Returns the type string if set

float

Return the vertical percentage bias that is used when two opposite connections exist of the same strength.

ConstraintWidget

if in a vertical chain return the top most widget in the chain.

int

Set the chain starting from this widget to be packed.

ConstraintWidget.DimensionBehaviour

Accessor for the vertical dimension behaviour

int

Returns all the vertical margin of the widget

int

Returns the current visibility value for this widget

int

Return the width of the widget

int
int

Return the x position of the widget, relative to its container

int

Return the y position of the widget, relative to its container

boolean

Return true if this widget has a baseline

boolean
hasDanglingDimension(int orientation)
boolean
boolean
boolean
hasResolvedTargets(int orientation, int size)
void
immediateConnect(
    ConstraintAnchor.Type startType,
    ConstraintWidget target,
    ConstraintAnchor.Type endType,
    int margin,
    int goneMargin
)

Immediate connection to an anchor without any checks.

boolean

Returns if this widget is animated.

boolean

Returns true if height is set to wrap_content

boolean
boolean
isInBarrier(int orientation)
boolean

Test if you are in a Horizontal chain

boolean
boolean

Test if you are in a vertical chain

boolean
boolean
boolean
boolean
boolean

Returns true if the widget is the root widget

boolean
boolean
boolean
boolean

Returns true if width is set to wrap_content

void
void
boolean
oppositeDimensionDependsOn(int orientation)
boolean
void
void

Reset all the constraints set on this widget

void

Reset the given anchor

void

Reset all connections

void
void

Reset the solver variables of the anchors

void
StringBuilder

Serialize the anchors for JSON5 output

void
setAnimated(boolean animated)

Set if this widget is animated.

void
setBaselineDistance(int baseline)

Set the baseline distance relative to the top of the widget

void

Set the companion widget.

void

Set the skip value for this widget.

void

Set the debug name of this widget

void

Utility debug function.

void
setDimension(int w, int h)

Set both width and height of the widget

void

Set the ratio of the widget

void
setDimensionRatio(float ratio, int dimensionRatioSide)

Set the ratio of the widget The ratio will be applied if at least one of the dimension (width or height) is set to a behaviour of DimensionBehaviour.MATCH_CONSTRAINT -- the dimension's value will be set to the other dimension * ratio.

void
setFinalBaseline(int baselineValue)
void
setFinalFrame(
    int left,
    int top,
    int right,
    int bottom,
    int baseline,
    int orientation
)
void
setFinalHorizontal(int x1, int x2)
void
setFinalLeft(int x1)
void
setFinalTop(int y1)
void
setFinalVertical(int y1, int y2)
void
setFrame(int start, int end, int orientation)

Set the position+dimension of the widget based on starting/ending positions on one dimension.

void
setFrame(int left, int top, int right, int bottom)

Set the position+dimension of the widget given left/top/right/bottom

void
setGoneMargin(ConstraintAnchor.Type type, int goneMargin)

Set the margin to be used when connected to a widget with a visibility of GONE

void
setHasBaseline(boolean hasBaseline)
void
setHeight(int h)

Set the height of the widget

void
setHeightWrapContent(boolean heightWrapContent)

Keep track of wrap_content for height

void
setHorizontalBiasPercent(float horizontalBiasPercent)

Set the horizontal bias percent to apply when we have two opposite constraints of equal strength

void
setHorizontalChainStyle(int horizontalChainStyle)

Set the chain starting from this widget to be packed.

void
setHorizontalDimension(int left, int right)

Set the positions for the horizontal dimension only

void

Set the widget's behaviour for the horizontal dimension

void
setHorizontalMatchStyle(
    int horizontalMatchStyle,
    int min,
    int max,
    float percent
)

Set the horizontal style when MATCH_CONSTRAINT is set

void
setHorizontalWeight(float horizontalWeight)

Set the horizontal weight (only used in chains)

void
setInBarrier(int orientation, boolean value)
void
setInPlaceholder(boolean inPlaceholder)
void
setInVirtualLayout(boolean inVirtualLayout)
void
setLastMeasureSpec(int horizontal, int vertical)
void
setLength(int length, int orientation)

Set the dimension of a widget in a particular orientation.

void
setMaxHeight(int maxHeight)
void
setMaxWidth(int maxWidth)
void
setMeasureRequested(boolean measureRequested)
void
setMinHeight(int h)

Set the minimum height of the widget

void
setMinWidth(int w)

Set the minimum width of the widget

void
setOffset(int x, int y)

Set the offset of this widget relative to the root widget

void
setOrigin(int x, int y)

Set both the origin in (x, y) of the widget, relative to its container

void

Set the parent of this widget

void

Set the type of the widget (as a String)

void
setVerticalBiasPercent(float verticalBiasPercent)

Set the vertical bias percent to apply when we have two opposite constraints of equal strength

void
setVerticalChainStyle(int verticalChainStyle)

Set the chain starting from this widget to be packed.

void
setVerticalDimension(int top, int bottom)

Set the positions for the vertical dimension only

void

Set the widget's behaviour for the vertical dimension

void
setVerticalMatchStyle(
    int verticalMatchStyle,
    int min,
    int max,
    float percent
)

Set the vertical style when MATCH_CONSTRAINT is set

void
setVerticalWeight(float verticalWeight)

Set the vertical weight (only used in chains)

void
setVisibility(int visibility)

Set the visibility for this widget

void
setWidth(int w)

Set the width of the widget

void
setWidthWrapContent(boolean widthWrapContent)

Keep track of wrap_content for width

void
void
setX(int x)

Set the x position of the widget, relative to its container

void
setY(int y)

Set the y position of the widget, relative to its container

void
setupDimensionRatio(
    boolean hParentWrapContent,
    boolean vParentWrapContent,
    boolean horizontalDimensionFixed,
    boolean verticalDimensionFixed
)

Resolves the dimension ratio parameters (mResolvedDimensionRatioSide &mDimensionRatio)

String

Returns a string representation of the ConstraintWidget

void
updateFromRuns(boolean updateHorizontal, boolean updateVertical)
void
updateFromSolver(LinearSystem system, boolean optimize)

Update the widget from the values generated by the solver

From androidx.constraintlayout.core.widgets.HelperWidget
void

Add a widget to the helper

void
addDependents(
    ArrayList<WidgetGroup> dependencyLists,
    int orientation,
    WidgetGroup group
)
int
findGroupInDependents(int orientation)
void

Reset the widgets list contained by this helper

From androidx.constraintlayout.core.widgets.VirtualLayout
void
applyRtl(boolean isRtl)
void
boolean
int
int
int
int
int
int
void
measure(
    ConstraintWidget widget,
    ConstraintWidget.DimensionBehaviour horizontalBehavior,
    int horizontalDimension,
    ConstraintWidget.DimensionBehaviour verticalBehavior,
    int verticalDimension
)
boolean
boolean
void
needsCallbackFromSolver(boolean value)
void
setMeasure(int width, int height)
void
setPadding(int value)
void
setPaddingBottom(int value)
void
setPaddingEnd(int value)
void
setPaddingLeft(int value)
void
setPaddingRight(int value)
void
setPaddingStart(int value)
void
setPaddingTop(int value)
void

Constants

HORIZONTAL_ALIGN_CENTER

Added in 1.1.0
public static final int HORIZONTAL_ALIGN_CENTER = 2

HORIZONTAL_ALIGN_END

Added in 1.1.0
public static final int HORIZONTAL_ALIGN_END = 1

HORIZONTAL_ALIGN_START

Added in 1.1.0
public static final int HORIZONTAL_ALIGN_START = 0

VERTICAL_ALIGN_BASELINE

Added in 1.1.0
public static final int VERTICAL_ALIGN_BASELINE = 3

VERTICAL_ALIGN_BOTTOM

Added in 1.1.0
public static final int VERTICAL_ALIGN_BOTTOM = 1

VERTICAL_ALIGN_CENTER

Added in 1.1.0
public static final int VERTICAL_ALIGN_CENTER = 2

VERTICAL_ALIGN_TOP

Added in 1.1.0
public static final int VERTICAL_ALIGN_TOP = 0

WRAP_ALIGNED

Added in 1.1.0
public static final int WRAP_ALIGNED = 2

WRAP_CHAIN

Added in 1.1.0
public static final int WRAP_CHAIN = 1

WRAP_CHAIN_NEW

Added in 1.1.0
public static final int WRAP_CHAIN_NEW = 3

WRAP_NONE

Added in 1.1.0
public static final int WRAP_NONE = 0

Public constructors

Flow

Added in 1.1.0
public Flow()

Public methods

addToSolver

public void addToSolver(LinearSystem system, boolean optimize)

Add this widget to the solver

Parameters
LinearSystem system

the solver we want to add the widget to

boolean optimize

true if OPTIMIZATION_GRAPH is on

copy

public void copy(
    ConstraintWidget src,
    HashMap<ConstraintWidgetConstraintWidget> map
)

getMaxElementsWrap

Added in 1.1.0
public float getMaxElementsWrap()

measure

public void measure(int widthMode, int widthSize, int heightMode, int heightSize)

setFirstHorizontalBias

Added in 1.1.0
public void setFirstHorizontalBias(float value)

setFirstHorizontalStyle

Added in 1.1.0
public void setFirstHorizontalStyle(int value)

setFirstVerticalBias

Added in 1.1.0
public void setFirstVerticalBias(float value)

setFirstVerticalStyle

Added in 1.1.0
public void setFirstVerticalStyle(int value)

setHorizontalAlign

Added in 1.1.0
public void setHorizontalAlign(int value)

setHorizontalBias

Added in 1.1.0
public void setHorizontalBias(float value)

setHorizontalGap

Added in 1.1.0
public void setHorizontalGap(int value)

setHorizontalStyle

Added in 1.1.0
public void setHorizontalStyle(int value)

setLastHorizontalBias

Added in 1.1.0
public void setLastHorizontalBias(float value)

setLastHorizontalStyle

Added in 1.1.0
public void setLastHorizontalStyle(int value)

setLastVerticalBias

Added in 1.1.0
public void setLastVerticalBias(float value)

setLastVerticalStyle

Added in 1.1.0
public void setLastVerticalStyle(int value)

setMaxElementsWrap

Added in 1.1.0
public void setMaxElementsWrap(int value)

setOrientation

Added in 1.1.0
public void setOrientation(int value)

setVerticalAlign

Added in 1.1.0
public void setVerticalAlign(int value)

setVerticalBias

Added in 1.1.0
public void setVerticalBias(float value)

setVerticalGap

Added in 1.1.0
public void setVerticalGap(int value)

setVerticalStyle

Added in 1.1.0
public void setVerticalStyle(int value)

setWrapMode

Added in 1.1.0
public void setWrapMode(int value)