public class Guideline extends ConstraintWidget


Guideline

Summary

Constants

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

Protected fields

boolean
int
int
float

Public constructors

Public methods

void
addToSolver(LinearSystem system, boolean optimize)

Add this widget to the solver

boolean

Returns true if this widget should be used in a barrier

void
void
ConstraintAnchor
ConstraintAnchor

Given a type of anchor, returns the corresponding anchor.

int

Get the Minimum Position

int

get the orientation VERTICAL or HORIZONTAL

int
int
int
float
String

Specify the xml type for the container

boolean
boolean
boolean
void
setFinalValue(int position)
void
setGuideBegin(int value)
void
setGuideEnd(int value)
void
setGuidePercent(float value)
void
setGuidePercent(int value)
void
setMinimumPosition(int minimum)

set the minimum position

void
setOrientation(int orientation)
void
updateFromSolver(LinearSystem system, boolean optimize)

Update the widget from the values generated by the solver

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
)
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
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)

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

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)

Constants

HORIZONTAL

Added in 1.1.0-alpha13
public static final int HORIZONTAL = 0

RELATIVE_BEGIN

Added in 1.1.0-alpha13
public static final int RELATIVE_BEGIN = 1

RELATIVE_END

Added in 1.1.0-alpha13
public static final int RELATIVE_END = 2

RELATIVE_PERCENT

Added in 1.1.0-alpha13
public static final int RELATIVE_PERCENT = 0

RELATIVE_UNKNOWN

Added in 1.1.0-alpha13
public static final int RELATIVE_UNKNOWN = -1

VERTICAL

Added in 1.1.0-alpha13
public static final int VERTICAL = 1

Protected fields

mGuidelineUseRtl

Added in 1.1.0-alpha13
protected boolean mGuidelineUseRtl

mRelativeBegin

Added in 1.1.0-alpha13
protected int mRelativeBegin

mRelativeEnd

Added in 1.1.0-alpha13
protected int mRelativeEnd

mRelativePercent

Added in 1.1.0-alpha13
protected float mRelativePercent

Public constructors

Guideline

Added in 1.1.0-alpha13
public Guideline()

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

allowedInBarrier

public boolean allowedInBarrier()

Returns true if this widget should be used in a barrier

copy

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

cyclePosition

Added in 1.1.0-alpha13
public void cyclePosition()

getAnchor

Added in 1.1.0-alpha13
public ConstraintAnchor getAnchor()

getAnchor

public ConstraintAnchor getAnchor(ConstraintAnchor.Type anchorType)

Given a type of anchor, returns the corresponding anchor.

Parameters
ConstraintAnchor.Type anchorType

type of the anchor (LEFT, TOP, RIGHT, BOTTOM, BASELINE, CENTER_X, CENTER_Y)

Returns
ConstraintAnchor

the matching anchor

getMinimumPosition

Added in 1.1.0-alpha13
public int getMinimumPosition()

Get the Minimum Position

Returns
int

the Minimum Position

getOrientation

Added in 1.1.0-alpha13
public int getOrientation()

get the orientation VERTICAL or HORIZONTAL

Returns
int

orientation

getRelativeBegin

Added in 1.1.0-alpha13
public int getRelativeBegin()

getRelativeBehaviour

Added in 1.1.0-alpha13
public int getRelativeBehaviour()

getRelativeEnd

Added in 1.1.0-alpha13
public int getRelativeEnd()

getRelativePercent

Added in 1.1.0-alpha13
public float getRelativePercent()

getType

public String getType()

Specify the xml type for the container

isPercent

Added in 1.1.0-alpha13
public boolean isPercent()

isResolvedHorizontally

public boolean isResolvedHorizontally()

isResolvedVertically

public boolean isResolvedVertically()

setFinalValue

Added in 1.1.0-alpha13
public void setFinalValue(int position)

setGuideBegin

Added in 1.1.0-alpha13
public void setGuideBegin(int value)

setGuideEnd

Added in 1.1.0-alpha13
public void setGuideEnd(int value)

setGuidePercent

Added in 1.1.0-alpha13
public void setGuidePercent(float value)

setGuidePercent

Added in 1.1.0-alpha13
public void setGuidePercent(int value)

setMinimumPosition

Added in 1.1.0-alpha13
public void setMinimumPosition(int minimum)

set the minimum position

Parameters
int minimum

setOrientation

Added in 1.1.0-alpha13
public void setOrientation(int orientation)

updateFromSolver

public void updateFromSolver(LinearSystem system, boolean optimize)

Update the widget from the values generated by the solver

Parameters
LinearSystem system

the solver we get the values from.

boolean optimize

true if OPTIMIZATION_GRAPH is on