ConstraintWidgetContainer


class ConstraintWidgetContainer : WidgetContainer


A container of ConstraintWidget that can layout its children

Summary

Public constructors

Default constructor

ConstraintWidgetContainer(width: Int, height: Int)

Constructor

ConstraintWidgetContainer(debugName: String!, width: Int, height: Int)
ConstraintWidgetContainer(x: Int, y: Int, width: Int, height: Int)

Constructor

Public functions

Boolean

Add this widget to the solver

Unit
Unit
Unit
Boolean
directMeasure(optimizeWrap: Boolean)
Boolean
directMeasureSetup(optimizeWrap: Boolean)
Boolean
directMeasureWithOrientation(optimizeWrap: Boolean, orientation: Int)
Unit
fillMetrics(metrics: Metrics!)
ArrayList<Guideline!>!

Accessor to the horizontal guidelines contained in the table.

BasicMeasure.Measurer!
Int

Returns the current optimization level

Unit
LinearSystem!
String!

Specify the xml type for the container

ArrayList<Guideline!>!

Accessor to the vertical guidelines contained in the table.

Boolean

Indicates if the container knows how to layout its content on its own

Unit

Invalidate the graph of constraints

Unit

Invalidate the widgets measures

Boolean

Return true if the height given is too small for the content laid out

Boolean

Returns the rtl status.

Boolean

Return true if the width given is too small for the content laid out

Unit

Layout the tree of widgets

java-static Boolean
measure(
    level: Int,
    widget: ConstraintWidget!,
    measurer: BasicMeasure.Measurer!,
    measure: BasicMeasure.Measure!,
    measureStrategy: Int
)
Long
measure(
    optimizationLevel: Int,
    widthMode: Int,
    widthSize: Int,
    heightMode: Int,
    heightSize: Int,
    lastMeasureWidth: Int,
    lastMeasureHeight: Int,
    paddingX: Int,
    paddingY: Int
)

Measure the layout

Boolean
optimizeFor(feature: Int)

Returns true if the given feature should be optimized

Unit
Unit
Unit

Resolves the system directly when possible

Unit
setPadding(left: Int, top: Int, right: Int, bottom: Int)

Set the padding on this container.

Unit
setPass(pass: Int)

Keep track of the # of passes

Unit
setRtl(isRtl: Boolean)

Set the rtl status.

Boolean

Update the frame of the layout and its children from the solver

Unit
updateFromRuns(updateHorizontal: Boolean, updateVertical: Boolean)
Unit

Inherited functions

From androidx.constraintlayout.core.widgets.ConstraintWidget
Unit
addChildrenToSolverByDependency(
    container: ConstraintWidgetContainer!,
    system: LinearSystem!,
    widgets: HashSet<ConstraintWidget!>!,
    orientation: Int,
    addSelf: Boolean
)
Unit
addToSolver(system: LinearSystem!, optimize: Boolean)

Add this widget to the solver

Boolean

Returns true if this widget should be used in a barrier

Unit
connect(
    constraintFrom: ConstraintAnchor.Type!,
    target: ConstraintWidget!,
    constraintTo: ConstraintAnchor.Type!
)

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

Unit
connect(from: ConstraintAnchor!, to: ConstraintAnchor!, margin: Int)

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

Unit
connect(
    constraintFrom: ConstraintAnchor.Type!,
    target: ConstraintWidget!,
    constraintTo: ConstraintAnchor.Type!,
    margin: Int
)

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

Unit
connectCircularConstraint(
    target: ConstraintWidget!,
    angle: Float,
    radius: Int
)

Set a circular constraint

Unit
copy(
    src: ConstraintWidget!,
    map: HashMap<ConstraintWidget!, ConstraintWidget!>!
)
Unit

Create all the system variables for this widget

Unit
Unit
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(orientation: Int)

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

Any!

Return the companion widget.

Int

Accessor for the skip value

String!

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

ConstraintWidget.DimensionBehaviour!
getDimensionBehaviour(orientation: Int)

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(orientation: Int)

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(orientation: Int)

Return the next chain member if one exists

Int
Int
ConstraintWidget!

Returns the parent of this widget if there is one

ConstraintWidget!

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(orientation: Int)
Int

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

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(orientation: Int)
Boolean
Boolean
Boolean
hasResolvedTargets(orientation: Int, size: Int)
Unit
immediateConnect(
    startType: ConstraintAnchor.Type!,
    target: ConstraintWidget!,
    endType: ConstraintAnchor.Type!,
    margin: Int,
    goneMargin: Int
)

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(orientation: Int)
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

Unit
Unit
Boolean
Boolean
Unit

Reset all the constraints set on this widget

Unit

Reset the given anchor

Unit

Reset all connections

Unit
Unit
StringBuilder!

Serialize the anchors for JSON5 output

Unit
setAnimated(animated: Boolean)

Set if this widget is animated.

Unit

Set the baseline distance relative to the top of the widget

Unit
setCompanionWidget(companion: Any!)

Set the companion widget.

Unit

Set the skip value for this widget.

Unit

Set the debug name of this widget

Unit

Utility debug function.

Unit
setDimension(w: Int, h: Int)

Set both width and height of the widget

Unit

Set the ratio of the widget

Unit
setDimensionRatio(ratio: Float, dimensionRatioSide: Int)

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.

Unit
setFinalBaseline(baselineValue: Int)
Unit
setFinalFrame(
    left: Int,
    top: Int,
    right: Int,
    bottom: Int,
    baseline: Int,
    orientation: Int
)
Unit
Unit
Unit
Unit
setFinalVertical(y1: Int, y2: Int)
Unit
setFrame(start: Int, end: Int, orientation: Int)

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

Unit
setFrame(left: Int, top: Int, right: Int, bottom: Int)

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

Unit
setGoneMargin(type: ConstraintAnchor.Type!, goneMargin: Int)

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

Unit
setHasBaseline(hasBaseline: Boolean)
Unit

Set the height of the widget

Unit
setHeightWrapContent(heightWrapContent: Boolean)

Keep track of wrap_content for height

Unit
setHorizontalBiasPercent(horizontalBiasPercent: Float)

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

Unit
setHorizontalChainStyle(horizontalChainStyle: Int)

Set the chain starting from this widget to be packed.

Unit
setHorizontalDimension(left: Int, right: Int)

Set the positions for the horizontal dimension only

Unit

Set the widget's behaviour for the horizontal dimension

Unit
setHorizontalMatchStyle(
    horizontalMatchStyle: Int,
    min: Int,
    max: Int,
    percent: Float
)

Set the horizontal style when MATCH_CONSTRAINT is set

Unit
setHorizontalWeight(horizontalWeight: Float)

Set the horizontal weight (only used in chains)

Unit
setInBarrier(orientation: Int, value: Boolean)
Unit
setInPlaceholder(inPlaceholder: Boolean)
Unit
setInVirtualLayout(inVirtualLayout: Boolean)
Unit
setLastMeasureSpec(horizontal: Int, vertical: Int)
Unit
setLength(length: Int, orientation: Int)

Set the dimension of a widget in a particular orientation.

Unit
setMaxHeight(maxHeight: Int)
Unit
setMaxWidth(maxWidth: Int)
Unit
setMeasureRequested(measureRequested: Boolean)
Unit

Set the minimum height of the widget

Unit

Set the minimum width of the widget

Unit
setOrigin(x: Int, y: Int)

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

Unit

Set the parent of this widget

Unit
setType(type: String!)

Set the type of the widget (as a String)

Unit
setVerticalBiasPercent(verticalBiasPercent: Float)

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

Unit
setVerticalChainStyle(verticalChainStyle: Int)

Set the chain starting from this widget to be packed.

Unit
setVerticalDimension(top: Int, bottom: Int)

Set the positions for the vertical dimension only

Unit

Set the widget's behaviour for the vertical dimension

Unit
setVerticalMatchStyle(
    verticalMatchStyle: Int,
    min: Int,
    max: Int,
    percent: Float
)

Set the vertical style when MATCH_CONSTRAINT is set

Unit
setVerticalWeight(verticalWeight: Float)

Set the vertical weight (only used in chains)

Unit
setVisibility(visibility: Int)

Set the visibility for this widget

Unit

Set the width of the widget

Unit
setWidthWrapContent(widthWrapContent: Boolean)

Keep track of wrap_content for width

Unit
Unit
setX(x: Int)

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

Unit
setY(y: Int)

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

Unit
setupDimensionRatio(
    hParentWrapContent: Boolean,
    vParentWrapContent: Boolean,
    horizontalDimensionFixed: Boolean,
    verticalDimensionFixed: Boolean
)

Resolves the dimension ratio parameters (mResolvedDimensionRatioSide &mDimensionRatio)

String!

Returns a string representation of the ConstraintWidget

Unit
updateFromSolver(system: LinearSystem!, optimize: Boolean)

Update the widget from the values generated by the solver

From androidx.constraintlayout.core.widgets.WidgetContainer
Unit

Add a child widget

Unit
add(widgets: Array<ConstraintWidget!>!)

Add multiple child widgets.

ArrayList<ConstraintWidget!>!

Access the children

ConstraintWidgetContainer!

Return the top-level ConstraintWidgetContainer

Unit

Remove a child widget

Unit
Unit

Reset the solver variables of the anchors

Unit
setOffset(x: Int, y: Int)

Set the offset of this widget relative to the root widget.

Public constructors

ConstraintWidgetContainer

Added in 1.1.0-rc01
ConstraintWidgetContainer()

Default constructor

ConstraintWidgetContainer

Added in 1.1.0-rc01
ConstraintWidgetContainer(width: Int, height: Int)

Constructor

Parameters
width: Int

width of the layout

height: Int

height of the layout

ConstraintWidgetContainer

Added in 1.1.0-rc01
ConstraintWidgetContainer(debugName: String!, width: Int, height: Int)

ConstraintWidgetContainer

Added in 1.1.0-rc01
ConstraintWidgetContainer(x: Int, y: Int, width: Int, height: Int)

Constructor

Parameters
x: Int

x position

y: Int

y position

width: Int

width of the layout

height: Int

height of the layout

Public functions

addChildrenToSolver

Added in 1.1.0-rc01
fun addChildrenToSolver(system: LinearSystem!): Boolean

Add this widget to the solver

Parameters
system: LinearSystem!

the solver we want to add the widget to

addHorizontalWrapMaxVariable

Added in 1.1.0-rc01
fun addHorizontalWrapMaxVariable(right: ConstraintAnchor!): Unit

addHorizontalWrapMinVariable

Added in 1.1.0-rc01
fun addHorizontalWrapMinVariable(left: ConstraintAnchor!): Unit

defineTerminalWidgets

Added in 1.1.0-rc01
fun defineTerminalWidgets(): Unit

directMeasure

Added in 1.1.0-rc01
fun directMeasure(optimizeWrap: Boolean): Boolean

directMeasureSetup

Added in 1.1.0-rc01
fun directMeasureSetup(optimizeWrap: Boolean): Boolean

directMeasureWithOrientation

Added in 1.1.0-rc01
fun directMeasureWithOrientation(optimizeWrap: Boolean, orientation: Int): Boolean

fillMetrics

Added in 1.1.0-rc01
fun fillMetrics(metrics: Metrics!): Unit

getHorizontalGuidelines

Added in 1.1.0-rc01
fun getHorizontalGuidelines(): ArrayList<Guideline!>!

Accessor to the horizontal guidelines contained in the table.

Returns
ArrayList<Guideline!>!

array of guidelines

getMeasurer

Added in 1.1.0-rc01
fun getMeasurer(): BasicMeasure.Measurer!

getOptimizationLevel

Added in 1.1.0-rc01
fun getOptimizationLevel(): Int

Returns the current optimization level

getSceneString

fun getSceneString(ret: StringBuilder!): Unit

getSystem

Added in 1.1.0-rc01
fun getSystem(): LinearSystem!

getType

fun getType(): String!

Specify the xml type for the container

getVerticalGuidelines

Added in 1.1.0-rc01
fun getVerticalGuidelines(): ArrayList<Guideline!>!

Accessor to the vertical guidelines contained in the table.

Returns
ArrayList<Guideline!>!

array of guidelines

handlesInternalConstraints

Added in 1.1.0-rc01
fun handlesInternalConstraints(): Boolean

Indicates if the container knows how to layout its content on its own

Returns
Boolean

true if the container does the layout, false otherwise

invalidateGraph

Added in 1.1.0-rc01
fun invalidateGraph(): Unit

Invalidate the graph of constraints

invalidateMeasures

Added in 1.1.0-rc01
fun invalidateMeasures(): Unit

Invalidate the widgets measures

isHeightMeasuredTooSmall

Added in 1.1.0-rc01
fun isHeightMeasuredTooSmall(): Boolean

Return true if the height given is too small for the content laid out

isRtl

Added in 1.1.0-rc01
fun isRtl(): Boolean

Returns the rtl status.

Returns
Boolean

true if in RTL, false otherwise.

isWidthMeasuredTooSmall

Added in 1.1.0-rc01
fun isWidthMeasuredTooSmall(): Boolean

Return true if the width given is too small for the content laid out

layout

fun layout(): Unit

Layout the tree of widgets

measure

Added in 1.1.0-rc01
java-static fun measure(
    level: Int,
    widget: ConstraintWidget!,
    measurer: BasicMeasure.Measurer!,
    measure: BasicMeasure.Measure!,
    measureStrategy: Int
): Boolean

measure

Added in 1.1.0-rc01
fun measure(
    optimizationLevel: Int,
    widthMode: Int,
    widthSize: Int,
    heightMode: Int,
    heightSize: Int,
    lastMeasureWidth: Int,
    lastMeasureHeight: Int,
    paddingX: Int,
    paddingY: Int
): Long

Measure the layout

optimizeFor

Added in 1.1.0-rc01
fun optimizeFor(feature: Int): Boolean

Returns true if the given feature should be optimized

reset

fun reset(): Unit

setMeasurer

Added in 1.1.0-rc01
fun setMeasurer(measurer: BasicMeasure.Measurer!): Unit

setOptimizationLevel

Added in 1.1.0-rc01
fun setOptimizationLevel(value: Int): Unit

Resolves the system directly when possible

Parameters
value: Int

optimization level

setPadding

Added in 1.1.0-rc01
fun setPadding(left: Int, top: Int, right: Int, bottom: Int): Unit

Set the padding on this container. It will apply to the position of the children.

Parameters
left: Int

left padding

top: Int

top padding

right: Int

right padding

bottom: Int

bottom padding

setPass

Added in 1.1.0-rc01
fun setPass(pass: Int): Unit

Keep track of the # of passes

setRtl

Added in 1.1.0-rc01
fun setRtl(isRtl: Boolean): Unit

Set the rtl status. This has implications for Chains.

Parameters
isRtl: Boolean

true if we are in RTL.

updateChildrenFromSolver

Added in 1.1.0-rc01
fun updateChildrenFromSolver(system: LinearSystem!, flags: BooleanArray!): Boolean

Update the frame of the layout and its children from the solver

Parameters
system: LinearSystem!

the solver we get the values from.

updateFromRuns

fun updateFromRuns(updateHorizontal: Boolean, updateVertical: Boolean): Unit

updateHierarchy

Added in 1.1.0-rc01
fun updateHierarchy(): Unit

Public properties

mDependencyGraph

Added in 1.1.0-rc01
val mDependencyGraphDependencyGraph!

mGroupsWrapOptimized

Added in 1.1.0-rc01
val mGroupsWrapOptimizedBoolean

mHorizontalChainsSize

Added in 1.1.0-rc01
val mHorizontalChainsSizeInt

mHorizontalWrapOptimized

Added in 1.1.0-rc01
val mHorizontalWrapOptimizedBoolean

mMeasure

Added in 1.1.0-rc01
val mMeasureBasicMeasure.Measure!

mMetrics

Added in 1.1.0-rc01
val mMetricsMetrics!

mSkipSolver

Added in 1.1.0-rc01
val mSkipSolverBoolean

mVerticalChainsSize

Added in 1.1.0-rc01
val mVerticalChainsSizeInt

mVerticalWrapOptimized

Added in 1.1.0-rc01
val mVerticalWrapOptimizedBoolean

mWrapFixedHeight

Added in 1.1.0-rc01
val mWrapFixedHeightInt

mWrapFixedWidth

Added in 1.1.0-rc01
val mWrapFixedWidthInt

Protected properties

mMeasurer

Added in 1.1.0-rc01
protected val mMeasurerBasicMeasure.Measurer!

mSystem

Added in 1.1.0-rc01
protected val mSystemLinearSystem!