public class Constraint


Provides the API for creating a Constraint Object for use in the Core ConstraintLayout &MotionLayout system

Summary

Nested types

public inner class Constraint.Anchor
public inner class Constraint.HAnchor extends Constraint.Anchor
public enum Constraint.HSide
public enum Constraint.Side
public inner class Constraint.VAnchor extends Constraint.Anchor
public enum Constraint.VSide

Constants

static final Constraint

Public constructors

Public methods

String

convert a String array into a String representation

Constraint.VAnchor

get baseline anchor

Constraint.VAnchor

get bottom anchor

float

get circleAngle

String

get circleConstraint

int

get circleRadius

String

get dimensionRatio

int

get editorAbsoluteX

int

get editorAbsoluteY

Constraint.HAnchor

get end anchor

int

get height

Constraint.Behaviour

get heightDefault

int

get heightMax

int

get heightMin

float

get heightPercent

float

get horizontalBias

Constraint.ChainMode

get horizontalChainStyle

float

get horizontalWeight

Constraint.HAnchor

get left anchor

String[]

get referenceIds

Constraint.HAnchor

get right anchor

Constraint.HAnchor

get start anchor

Constraint.VAnchor

get top anchor

float

get verticalBias

Constraint.ChainMode

get verticalChainStyle

float

get verticalWeight

int

get width

Constraint.Behaviour

get widthDefault

int

get widthMax

int

get widthMin

float

get widthPercent

boolean

is constrainedHeight

boolean

is constrainedWidth

void

Connect anchor to Baseline

void
linkToBaseline(Constraint.VAnchor anchor, int margin)

Connect anchor to Baseline

void
linkToBaseline(Constraint.VAnchor anchor, int margin, int goneMargin)

Connect anchor to Baseline

void

Connect anchor to Bottom

void
linkToBottom(Constraint.VAnchor anchor, int margin)

Connect anchor to Bottom

void
linkToBottom(Constraint.VAnchor anchor, int margin, int goneMargin)

Connect anchor to Bottom

void

Connect anchor to End

void
linkToEnd(Constraint.HAnchor anchor, int margin)

Connect anchor to End

void
linkToEnd(Constraint.HAnchor anchor, int margin, int goneMargin)

Connect anchor to End

void

Connect anchor to Left

void
linkToLeft(Constraint.HAnchor anchor, int margin)

Connect anchor to Left

void
linkToLeft(Constraint.HAnchor anchor, int margin, int goneMargin)

Connect anchor to Left

void

Connect anchor to Right

void
linkToRight(Constraint.HAnchor anchor, int margin)

Connect anchor to Right

void
linkToRight(Constraint.HAnchor anchor, int margin, int goneMargin)

Connect anchor to Right

void

Connect anchor to Start

void
linkToStart(Constraint.HAnchor anchor, int margin)

Connect anchor to Start

void
linkToStart(Constraint.HAnchor anchor, int margin, int goneMargin)

Connect anchor to Start

void

Connect anchor to Top

void
linkToTop(Constraint.VAnchor anchor, int margin)

Connect anchor to Top

void
linkToTop(Constraint.VAnchor anchor, int margin, int goneMargin)

Connect anchor to Top

void
setCircleAngle(float circleAngle)

set circleAngle

void
setCircleConstraint(String circleConstraint)

set circleConstraint

void
setCircleRadius(int circleRadius)

set circleRadius

void
setConstrainedHeight(boolean constrainedHeight)

set constrainedHeight

void
setConstrainedWidth(boolean constrainedWidth)

set constrainedWidth

void
setDimensionRatio(String dimensionRatio)

set dimensionRatio

void
setEditorAbsoluteX(int editorAbsoluteX)

set editorAbsoluteX

void
setEditorAbsoluteY(int editorAbsoluteY)

set editorAbsoluteY

void
setHeight(int height)

set height

void

set heightDefault

void
setHeightMax(int heightMax)

set heightMax

void
setHeightMin(int heightMin)

set heightMin

void
setHeightPercent(float heightPercent)

set heightPercent

void
setHorizontalBias(float horizontalBias)

set horizontalBias

void

set horizontalChainStyle

void
setHorizontalWeight(float horizontalWeight)

set horizontalWeight

void
setReferenceIds(String[] referenceIds)

set referenceIds

void
setVerticalBias(float verticalBias)

set verticalBias

void

set verticalChainStyle

void
setVerticalWeight(float verticalWeight)

set verticalWeight

void
setWidth(int width)

set width

void

set widthDefault

void
setWidthMax(int widthMax)

set widthMax

void
setWidthMin(int widthMin)

set widthMin

void
setWidthPercent(float widthPercent)

set widthPercent

String

Protected methods

void
append(StringBuilder builder, String name, float value)

Constants

PARENT

Added in 1.1.0
public static final Constraint PARENT

Public constructors

Constraint

Added in 1.1.0
public Constraint(String id)

Public methods

convertStringArrayToString

Added in 1.1.0
public String convertStringArrayToString(String[] str)

convert a String array into a String representation

Parameters
String[] str

String array to be converted

Returns
String

a String representation of the input array.

getBaseline

Added in 1.1.0
public Constraint.VAnchor getBaseline()

get baseline anchor

Returns
Constraint.VAnchor

baseline anchor

getBottom

Added in 1.1.0
public Constraint.VAnchor getBottom()

get bottom anchor

Returns
Constraint.VAnchor

bottom anchor

getCircleAngle

Added in 1.1.0
public float getCircleAngle()

get circleAngle

Returns
float

circleAngle

getCircleConstraint

Added in 1.1.0
public String getCircleConstraint()

get circleConstraint

Returns
String

circleConstraint

getCircleRadius

Added in 1.1.0
public int getCircleRadius()

get circleRadius

Returns
int

circleRadius

getDimensionRatio

Added in 1.1.0
public String getDimensionRatio()

get dimensionRatio

Returns
String

dimensionRatio

getEditorAbsoluteX

Added in 1.1.0
public int getEditorAbsoluteX()

get editorAbsoluteX

Returns
int

editorAbsoluteX

getEditorAbsoluteY

Added in 1.1.0
public int getEditorAbsoluteY()

get editorAbsoluteY

Returns
int

editorAbsoluteY

getEnd

Added in 1.1.0
public Constraint.HAnchor getEnd()

get end anchor

Returns
Constraint.HAnchor

end anchor

getHeight

Added in 1.1.0
public int getHeight()

get height

Returns
int

height

getHeightDefault

Added in 1.1.0
public Constraint.Behaviour getHeightDefault()

get heightDefault

Returns
Constraint.Behaviour

heightDefault

getHeightMax

Added in 1.1.0
public int getHeightMax()

get heightMax

Returns
int

heightMax

getHeightMin

Added in 1.1.0
public int getHeightMin()

get heightMin

Returns
int

heightMin

getHeightPercent

Added in 1.1.0
public float getHeightPercent()

get heightPercent

Returns
float

heightPercent

getHorizontalBias

Added in 1.1.0
public float getHorizontalBias()

get horizontalBias

Returns
float

horizontalBias

getHorizontalChainStyle

Added in 1.1.0
public Constraint.ChainMode getHorizontalChainStyle()

get horizontalChainStyle

Returns
Constraint.ChainMode

horizontalChainStyle

getHorizontalWeight

Added in 1.1.0
public float getHorizontalWeight()

get horizontalWeight

Returns
float

horizontalWeight

getLeft

Added in 1.1.0
public Constraint.HAnchor getLeft()

get left anchor

Returns
Constraint.HAnchor

left anchor

getReferenceIds

Added in 1.1.0
public String[] getReferenceIds()

get referenceIds

Returns
String[]

referenceIds

getRight

Added in 1.1.0
public Constraint.HAnchor getRight()

get right anchor

Returns
Constraint.HAnchor

right anchor

getStart

Added in 1.1.0
public Constraint.HAnchor getStart()

get start anchor

Returns
Constraint.HAnchor

start anchor

getTop

Added in 1.1.0
public Constraint.VAnchor getTop()

get top anchor

Returns
Constraint.VAnchor

top anchor

getVerticalBias

Added in 1.1.0
public float getVerticalBias()

get verticalBias

Returns
float

verticalBias

getVerticalChainStyle

Added in 1.1.0
public Constraint.ChainMode getVerticalChainStyle()

get verticalChainStyle

Returns
Constraint.ChainMode

verticalChainStyle

getVerticalWeight

Added in 1.1.0
public float getVerticalWeight()

get verticalWeight

Returns
float

verticalWeight

getWidth

Added in 1.1.0
public int getWidth()

get width

Returns
int

width

getWidthDefault

Added in 1.1.0
public Constraint.Behaviour getWidthDefault()

get widthDefault

Returns
Constraint.Behaviour

widthDefault

getWidthMax

Added in 1.1.0
public int getWidthMax()

get widthMax

Returns
int

widthMax

getWidthMin

Added in 1.1.0
public int getWidthMin()

get widthMin

Returns
int

widthMin

getWidthPercent

Added in 1.1.0
public float getWidthPercent()

get widthPercent

Returns
float

isConstrainedHeight

Added in 1.1.0
public boolean isConstrainedHeight()

is constrainedHeight

Returns
boolean

true if height constrained

isConstrainedWidth

Added in 1.1.0
public boolean isConstrainedWidth()

is constrainedWidth

Returns
boolean

true if width constrained

linkToBaseline

Added in 1.1.0
public void linkToBaseline(Constraint.VAnchor anchor)

Connect anchor to Baseline

Parameters
Constraint.VAnchor anchor

anchor to be connected

linkToBaseline

Added in 1.1.0
public void linkToBaseline(Constraint.VAnchor anchor, int margin)

Connect anchor to Baseline

Parameters
Constraint.VAnchor anchor

anchor to be connected

int margin

value of the margin

linkToBaseline

Added in 1.1.0
public void linkToBaseline(Constraint.VAnchor anchor, int margin, int goneMargin)

Connect anchor to Baseline

Parameters
Constraint.VAnchor anchor

anchor to be connected

int margin

value of the margin

int goneMargin

value of the goneMargin

linkToBottom

Added in 1.1.0
public void linkToBottom(Constraint.VAnchor anchor)

Connect anchor to Bottom

Parameters
Constraint.VAnchor anchor

anchor to be connected

linkToBottom

Added in 1.1.0
public void linkToBottom(Constraint.VAnchor anchor, int margin)

Connect anchor to Bottom

Parameters
Constraint.VAnchor anchor

anchor to be connected

int margin

value of the margin

linkToBottom

Added in 1.1.0
public void linkToBottom(Constraint.VAnchor anchor, int margin, int goneMargin)

Connect anchor to Bottom

Parameters
Constraint.VAnchor anchor

anchor to be connected

int margin

value of the margin

int goneMargin

value of the goneMargin

linkToEnd

Added in 1.1.0
public void linkToEnd(Constraint.HAnchor anchor)

Connect anchor to End

Parameters
Constraint.HAnchor anchor

anchor to be connected

linkToEnd

Added in 1.1.0
public void linkToEnd(Constraint.HAnchor anchor, int margin)

Connect anchor to End

Parameters
Constraint.HAnchor anchor

anchor to be connected

int margin

value of the margin

linkToEnd

Added in 1.1.0
public void linkToEnd(Constraint.HAnchor anchor, int margin, int goneMargin)

Connect anchor to End

Parameters
Constraint.HAnchor anchor

anchor to be connected

int margin

value of the margin

int goneMargin

value of the goneMargin

linkToLeft

Added in 1.1.0
public void linkToLeft(Constraint.HAnchor anchor)

Connect anchor to Left

Parameters
Constraint.HAnchor anchor

anchor to be connected

linkToLeft

Added in 1.1.0
public void linkToLeft(Constraint.HAnchor anchor, int margin)

Connect anchor to Left

Parameters
Constraint.HAnchor anchor

anchor to be connected

int margin

value of the margin

linkToLeft

Added in 1.1.0
public void linkToLeft(Constraint.HAnchor anchor, int margin, int goneMargin)

Connect anchor to Left

Parameters
Constraint.HAnchor anchor

anchor to be connected

int margin

value of the margin

int goneMargin

value of the goneMargin

linkToRight

Added in 1.1.0
public void linkToRight(Constraint.HAnchor anchor)

Connect anchor to Right

Parameters
Constraint.HAnchor anchor

anchor to be connected

linkToRight

Added in 1.1.0
public void linkToRight(Constraint.HAnchor anchor, int margin)

Connect anchor to Right

Parameters
Constraint.HAnchor anchor

anchor to be connected

int margin

value of the margin

linkToRight

Added in 1.1.0
public void linkToRight(Constraint.HAnchor anchor, int margin, int goneMargin)

Connect anchor to Right

Parameters
Constraint.HAnchor anchor

anchor to be connected

int margin

value of the margin

int goneMargin

value of the goneMargin

linkToStart

Added in 1.1.0
public void linkToStart(Constraint.HAnchor anchor)

Connect anchor to Start

Parameters
Constraint.HAnchor anchor

anchor to be connected

linkToStart

Added in 1.1.0
public void linkToStart(Constraint.HAnchor anchor, int margin)

Connect anchor to Start

Parameters
Constraint.HAnchor anchor

anchor to be connected

int margin

value of the margin

linkToStart

Added in 1.1.0
public void linkToStart(Constraint.HAnchor anchor, int margin, int goneMargin)

Connect anchor to Start

Parameters
Constraint.HAnchor anchor

anchor to be connected

int margin

value of the margin

int goneMargin

value of the goneMargin

linkToTop

Added in 1.1.0
public void linkToTop(Constraint.VAnchor anchor)

Connect anchor to Top

Parameters
Constraint.VAnchor anchor

anchor to be connected

linkToTop

Added in 1.1.0
public void linkToTop(Constraint.VAnchor anchor, int margin)

Connect anchor to Top

Parameters
Constraint.VAnchor anchor

anchor to be connected

int margin

value of the margin

linkToTop

Added in 1.1.0
public void linkToTop(Constraint.VAnchor anchor, int margin, int goneMargin)

Connect anchor to Top

Parameters
Constraint.VAnchor anchor

anchor to be connected

int margin

value of the margin

int goneMargin

value of the goneMargin

setCircleAngle

Added in 1.1.0
public void setCircleAngle(float circleAngle)

set circleAngle

Parameters
float circleAngle

setCircleConstraint

Added in 1.1.0
public void setCircleConstraint(String circleConstraint)

set circleConstraint

Parameters
String circleConstraint

setCircleRadius

Added in 1.1.0
public void setCircleRadius(int circleRadius)

set circleRadius

Parameters
int circleRadius

setConstrainedHeight

Added in 1.1.0
public void setConstrainedHeight(boolean constrainedHeight)

set constrainedHeight

Parameters
boolean constrainedHeight

setConstrainedWidth

Added in 1.1.0
public void setConstrainedWidth(boolean constrainedWidth)

set constrainedWidth

Parameters
boolean constrainedWidth

setDimensionRatio

Added in 1.1.0
public void setDimensionRatio(String dimensionRatio)

set dimensionRatio

Parameters
String dimensionRatio

setEditorAbsoluteX

Added in 1.1.0
public void setEditorAbsoluteX(int editorAbsoluteX)

set editorAbsoluteX

Parameters
int editorAbsoluteX

setEditorAbsoluteY

Added in 1.1.0
public void setEditorAbsoluteY(int editorAbsoluteY)

set editorAbsoluteY

Parameters
int editorAbsoluteY

setHeight

Added in 1.1.0
public void setHeight(int height)

set height

Parameters
int height

setHeightDefault

Added in 1.1.0
public void setHeightDefault(Constraint.Behaviour heightDefault)

set heightDefault

Parameters
Constraint.Behaviour heightDefault

setHeightMax

Added in 1.1.0
public void setHeightMax(int heightMax)

set heightMax

Parameters
int heightMax

setHeightMin

Added in 1.1.0
public void setHeightMin(int heightMin)

set heightMin

Parameters
int heightMin

setHeightPercent

Added in 1.1.0
public void setHeightPercent(float heightPercent)

set heightPercent

Parameters
float heightPercent

setHorizontalBias

Added in 1.1.0
public void setHorizontalBias(float horizontalBias)

set horizontalBias

Parameters
float horizontalBias

setHorizontalChainStyle

Added in 1.1.0
public void setHorizontalChainStyle(Constraint.ChainMode horizontalChainStyle)

set horizontalChainStyle

Parameters
Constraint.ChainMode horizontalChainStyle

setHorizontalWeight

Added in 1.1.0
public void setHorizontalWeight(float horizontalWeight)

set horizontalWeight

Parameters
float horizontalWeight

setReferenceIds

Added in 1.1.0
public void setReferenceIds(String[] referenceIds)

set referenceIds

Parameters
String[] referenceIds

setVerticalBias

Added in 1.1.0
public void setVerticalBias(float verticalBias)

set verticalBias

Parameters
float verticalBias

setVerticalChainStyle

Added in 1.1.0
public void setVerticalChainStyle(Constraint.ChainMode verticalChainStyle)

set verticalChainStyle

Parameters
Constraint.ChainMode verticalChainStyle

setVerticalWeight

Added in 1.1.0
public void setVerticalWeight(float verticalWeight)

set verticalWeight

Parameters
float verticalWeight

setWidth

Added in 1.1.0
public void setWidth(int width)

set width

Parameters
int width

setWidthDefault

Added in 1.1.0
public void setWidthDefault(Constraint.Behaviour widthDefault)

set widthDefault

Parameters
Constraint.Behaviour widthDefault

setWidthMax

Added in 1.1.0
public void setWidthMax(int widthMax)

set widthMax

Parameters
int widthMax

setWidthMin

Added in 1.1.0
public void setWidthMin(int widthMin)

set widthMin

Parameters
int widthMin

setWidthPercent

Added in 1.1.0
public void setWidthPercent(float widthPercent)

set widthPercent

Parameters
float widthPercent

toString

public String toString()

Protected methods

append

Added in 1.1.0
protected void append(StringBuilder builder, String name, float value)