Constraint
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 enum Constraint.Behaviour |
public enum Constraint.ChainMode |
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 |
|---|
Constraint(String id) |
Public methods |
|
|---|---|
String |
convertStringArrayToString(String[] str)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 |
getEnd()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 |
getLeft()get left anchor |
String[] |
get referenceIds |
Constraint.HAnchor |
getRight()get right anchor |
Constraint.HAnchor |
getStart()get start anchor |
Constraint.VAnchor |
getTop()get top anchor |
float |
get verticalBias |
Constraint.ChainMode |
get verticalChainStyle |
float |
get verticalWeight |
int |
getWidth()get width |
Constraint.Behaviour |
get widthDefault |
int |
get widthMax |
int |
get widthMin |
float |
get widthPercent |
boolean |
is constrainedHeight |
boolean |
is constrainedWidth |
void |
linkToBaseline(Constraint.VAnchor anchor)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 |
linkToBottom(Constraint.VAnchor anchor)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 |
linkToEnd(Constraint.HAnchor anchor)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 |
linkToLeft(Constraint.HAnchor anchor)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 |
linkToRight(Constraint.HAnchor anchor)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 |
linkToStart(Constraint.HAnchor anchor)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 |
linkToTop(Constraint.VAnchor anchor)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 |
setHeightDefault(Constraint.Behaviour heightDefault)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 |
setHorizontalChainStyle(Constraint.ChainMode horizontalChainStyle)set horizontalChainStyle |
void |
setHorizontalWeight(float horizontalWeight)set horizontalWeight |
void |
setReferenceIds(String[] referenceIds)set referenceIds |
void |
setVerticalBias(float verticalBias)set verticalBias |
void |
setVerticalChainStyle(Constraint.ChainMode verticalChainStyle)set verticalChainStyle |
void |
setVerticalWeight(float verticalWeight)set verticalWeight |
void |
setWidth(int width)set width |
void |
setWidthDefault(Constraint.Behaviour widthDefault)set widthDefault |
void |
setWidthMax(int widthMax)set widthMax |
void |
setWidthMin(int widthMin)set widthMin |
void |
setWidthPercent(float widthPercent)set widthPercent |
String |
toString() |
Protected methods |
|
|---|---|
void |
append(StringBuilder builder, String name, float value) |
Constants
Public constructors
Public methods
convertStringArrayToString
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
public Constraint.VAnchor getBaseline()
get baseline anchor
| Returns | |
|---|---|
Constraint.VAnchor |
baseline anchor |
getBottom
public Constraint.VAnchor getBottom()
get bottom anchor
| Returns | |
|---|---|
Constraint.VAnchor |
bottom anchor |
getCircleAngle
public float getCircleAngle()
get circleAngle
| Returns | |
|---|---|
float |
circleAngle |
getCircleConstraint
public String getCircleConstraint()
get circleConstraint
| Returns | |
|---|---|
String |
circleConstraint |
getCircleRadius
public int getCircleRadius()
get circleRadius
| Returns | |
|---|---|
int |
circleRadius |
getDimensionRatio
public String getDimensionRatio()
get dimensionRatio
| Returns | |
|---|---|
String |
dimensionRatio |
getEditorAbsoluteX
public int getEditorAbsoluteX()
get editorAbsoluteX
| Returns | |
|---|---|
int |
editorAbsoluteX |
getEditorAbsoluteY
public int getEditorAbsoluteY()
get editorAbsoluteY
| Returns | |
|---|---|
int |
editorAbsoluteY |
getEnd
public Constraint.HAnchor getEnd()
get end anchor
| Returns | |
|---|---|
Constraint.HAnchor |
end anchor |
getHeightDefault
public Constraint.Behaviour getHeightDefault()
get heightDefault
| Returns | |
|---|---|
Constraint.Behaviour |
heightDefault |
getHeightPercent
public float getHeightPercent()
get heightPercent
| Returns | |
|---|---|
float |
heightPercent |
getHorizontalBias
public float getHorizontalBias()
get horizontalBias
| Returns | |
|---|---|
float |
horizontalBias |
getHorizontalChainStyle
public Constraint.ChainMode getHorizontalChainStyle()
get horizontalChainStyle
| Returns | |
|---|---|
Constraint.ChainMode |
horizontalChainStyle |
getHorizontalWeight
public float getHorizontalWeight()
get horizontalWeight
| Returns | |
|---|---|
float |
horizontalWeight |
getLeft
public Constraint.HAnchor getLeft()
get left anchor
| Returns | |
|---|---|
Constraint.HAnchor |
left anchor |
getReferenceIds
public String[] getReferenceIds()
get referenceIds
| Returns | |
|---|---|
String[] |
referenceIds |
getRight
public Constraint.HAnchor getRight()
get right anchor
| Returns | |
|---|---|
Constraint.HAnchor |
right anchor |
getStart
public Constraint.HAnchor getStart()
get start anchor
| Returns | |
|---|---|
Constraint.HAnchor |
start anchor |
getTop
public Constraint.VAnchor getTop()
get top anchor
| Returns | |
|---|---|
Constraint.VAnchor |
top anchor |
getVerticalBias
public float getVerticalBias()
get verticalBias
| Returns | |
|---|---|
float |
verticalBias |
getVerticalChainStyle
public Constraint.ChainMode getVerticalChainStyle()
get verticalChainStyle
| Returns | |
|---|---|
Constraint.ChainMode |
verticalChainStyle |
getVerticalWeight
public float getVerticalWeight()
get verticalWeight
| Returns | |
|---|---|
float |
verticalWeight |
getWidthDefault
public Constraint.Behaviour getWidthDefault()
get widthDefault
| Returns | |
|---|---|
Constraint.Behaviour |
widthDefault |
isConstrainedHeight
public boolean isConstrainedHeight()
is constrainedHeight
| Returns | |
|---|---|
boolean |
true if height constrained |
isConstrainedWidth
public boolean isConstrainedWidth()
is constrainedWidth
| Returns | |
|---|---|
boolean |
true if width constrained |
linkToBaseline
public void linkToBaseline(Constraint.VAnchor anchor)
Connect anchor to Baseline
| Parameters | |
|---|---|
Constraint.VAnchor anchor |
anchor to be connected |
linkToBaseline
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
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
public void linkToBottom(Constraint.VAnchor anchor)
Connect anchor to Bottom
| Parameters | |
|---|---|
Constraint.VAnchor anchor |
anchor to be connected |
linkToBottom
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
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
public void linkToEnd(Constraint.HAnchor anchor)
Connect anchor to End
| Parameters | |
|---|---|
Constraint.HAnchor anchor |
anchor to be connected |
linkToEnd
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
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
public void linkToLeft(Constraint.HAnchor anchor)
Connect anchor to Left
| Parameters | |
|---|---|
Constraint.HAnchor anchor |
anchor to be connected |
linkToLeft
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
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
public void linkToRight(Constraint.HAnchor anchor)
Connect anchor to Right
| Parameters | |
|---|---|
Constraint.HAnchor anchor |
anchor to be connected |
linkToRight
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
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
public void linkToStart(Constraint.HAnchor anchor)
Connect anchor to Start
| Parameters | |
|---|---|
Constraint.HAnchor anchor |
anchor to be connected |
linkToStart
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
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
public void linkToTop(Constraint.VAnchor anchor)
Connect anchor to Top
| Parameters | |
|---|---|
Constraint.VAnchor anchor |
anchor to be connected |
linkToTop
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
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
public void setCircleAngle(float circleAngle)
set circleAngle
| Parameters | |
|---|---|
float circleAngle |
setCircleConstraint
public void setCircleConstraint(String circleConstraint)
set circleConstraint
| Parameters | |
|---|---|
String circleConstraint |
setCircleRadius
public void setCircleRadius(int circleRadius)
set circleRadius
| Parameters | |
|---|---|
int circleRadius |
setConstrainedHeight
public void setConstrainedHeight(boolean constrainedHeight)
set constrainedHeight
| Parameters | |
|---|---|
boolean constrainedHeight |
setConstrainedWidth
public void setConstrainedWidth(boolean constrainedWidth)
set constrainedWidth
| Parameters | |
|---|---|
boolean constrainedWidth |
setDimensionRatio
public void setDimensionRatio(String dimensionRatio)
set dimensionRatio
| Parameters | |
|---|---|
String dimensionRatio |
setEditorAbsoluteX
public void setEditorAbsoluteX(int editorAbsoluteX)
set editorAbsoluteX
| Parameters | |
|---|---|
int editorAbsoluteX |
setEditorAbsoluteY
public void setEditorAbsoluteY(int editorAbsoluteY)
set editorAbsoluteY
| Parameters | |
|---|---|
int editorAbsoluteY |
setHeightDefault
public void setHeightDefault(Constraint.Behaviour heightDefault)
set heightDefault
| Parameters | |
|---|---|
Constraint.Behaviour heightDefault |
setHeightMax
public void setHeightMax(int heightMax)
set heightMax
| Parameters | |
|---|---|
int heightMax |
setHeightMin
public void setHeightMin(int heightMin)
set heightMin
| Parameters | |
|---|---|
int heightMin |
setHeightPercent
public void setHeightPercent(float heightPercent)
set heightPercent
| Parameters | |
|---|---|
float heightPercent |
setHorizontalBias
public void setHorizontalBias(float horizontalBias)
set horizontalBias
| Parameters | |
|---|---|
float horizontalBias |
setHorizontalChainStyle
public void setHorizontalChainStyle(Constraint.ChainMode horizontalChainStyle)
set horizontalChainStyle
| Parameters | |
|---|---|
Constraint.ChainMode horizontalChainStyle |
setHorizontalWeight
public void setHorizontalWeight(float horizontalWeight)
set horizontalWeight
| Parameters | |
|---|---|
float horizontalWeight |
setReferenceIds
public void setReferenceIds(String[] referenceIds)
set referenceIds
| Parameters | |
|---|---|
String[] referenceIds |
setVerticalBias
public void setVerticalBias(float verticalBias)
set verticalBias
| Parameters | |
|---|---|
float verticalBias |
setVerticalChainStyle
public void setVerticalChainStyle(Constraint.ChainMode verticalChainStyle)
set verticalChainStyle
| Parameters | |
|---|---|
Constraint.ChainMode verticalChainStyle |
setVerticalWeight
public void setVerticalWeight(float verticalWeight)
set verticalWeight
| Parameters | |
|---|---|
float verticalWeight |
setWidthDefault
public void setWidthDefault(Constraint.Behaviour widthDefault)
set widthDefault
| Parameters | |
|---|---|
Constraint.Behaviour widthDefault |
setWidthMax
public void setWidthMax(int widthMax)
set widthMax
| Parameters | |
|---|---|
int widthMax |
setWidthMin
public void setWidthMin(int widthMin)
set widthMin
| Parameters | |
|---|---|
int widthMin |
setWidthPercent
public void setWidthPercent(float widthPercent)
set widthPercent
| Parameters | |
|---|---|
float widthPercent |