State
public class State
Represents a full state of a ConstraintLayout
Summary
Nested types |
|---|
public enum State.Chain |
public enum State.Constraint |
public enum State.Direction |
public enum State.Helper |
public enum State.Wrap |
Public fields |
|
|---|---|
final ConstraintReference |
Public constructors |
|---|
State() |
Public methods |
|
|---|---|
void |
apply(ConstraintWidgetContainer container) |
BarrierReference |
barrier(Object key, State.Direction direction) |
void |
Baseline is needed for this object |
AlignHorizontallyReference |
centerHorizontally(Object[] references) |
AlignVerticallyReference |
centerVertically(Object[] references) |
ConstraintReference |
constraints(Object key) |
int |
convertDimension(Object value)Implements a conversion function for values, returning int. |
ConstraintReference |
Create a new reference given a key. |
void |
|
FlowReference |
Gets a reference to a Flow object. |
@NonNull GridReference |
Get a Grid reference |
FlowReference |
Get a HorizontalFlowReference |
FlowReference |
getHorizontalFlow(Object[] references)Get a HorizontalFlowReference and add it to references |
ArrayList<String> |
getIdsForTag(String tag) |
FlowReference |
Get a VerticalFlowReference |
FlowReference |
getVerticalFlow(Object[] references)Get a VerticalFlowReference and add it to references |
GuidelineReference |
|
State |
|
HelperReference |
helper(Object key, State.Helper type) |
HorizontalChainReference |
|
HorizontalChainReference |
horizontalChain(Object[] references) |
GuidelineReference |
|
boolean |
isBaselineNeeded(ConstraintWidget constraintWidget)Does this constraintWidget need a baseline |
boolean |
This method is deprecated. For consistency, use |
boolean |
isRtl()Returns true if layout direction is right to left. |
void |
|
void |
reset()Clear the state |
boolean |
sameFixedHeight(int height) |
boolean |
sameFixedWidth(int width) |
void |
setDpToPixel(CorePixelDp dpToPixel)Set the function that converts dp to Pixels |
State |
|
void |
This method is deprecated. For consistency, use |
void |
setRtl(boolean isRtl)Set whether the layout direction is right to left (Rtl). |
void |
|
State |
|
VerticalChainReference |
|
VerticalChainReference |
verticalChain(Object[] references) |
GuidelineReference |
verticalGuideline(Object key) |
State |
Public fields
Protected fields
Public methods
baselineNeededFor
public void baselineNeededFor(Object id)
Baseline is needed for this object
convertDimension
public int convertDimension(Object value)
Implements a conversion function for values, returning int. This can be used in case values (e.g. margins) are represented via an object, not directly an int.
| Parameters | |
|---|---|
Object value |
the object to convert from |
createConstraintReference
public ConstraintReference createConstraintReference(Object key)
Create a new reference given a key.
getFlow
public FlowReference getFlow(Object key, boolean vertical)
Gets a reference to a Flow object. Creating it if needed.
| Parameters | |
|---|---|
Object key |
id of the reference |
boolean vertical |
is it a vertical or horizontal flow |
| Returns | |
|---|---|
FlowReference |
a FlowReference |
getGrid
public @NonNull GridReference getGrid(@NonNull Object key, @NonNull String gridType)
Get a Grid reference
| Parameters | |
|---|---|
@NonNull Object key |
name of the reference object |
@NonNull String gridType |
type of Grid pattern - Grid, Row, or Column |
| Returns | |
|---|---|
@NonNull GridReference |
a GridReference object |
getHorizontalFlow
public FlowReference getHorizontalFlow()
Get a HorizontalFlowReference
| Returns | |
|---|---|
FlowReference |
a HorizontalFlowReference |
getHorizontalFlow
public FlowReference getHorizontalFlow(Object[] references)
Get a HorizontalFlowReference and add it to references
| Parameters | |
|---|---|
Object[] references |
references where we the HorizontalFlowReference |
| Returns | |
|---|---|
FlowReference |
a HorizontalFlowReference |
getVerticalFlow
public FlowReference getVerticalFlow()
Get a VerticalFlowReference
| Returns | |
|---|---|
FlowReference |
a VerticalFlowReference |
getVerticalFlow
public FlowReference getVerticalFlow(Object[] references)
Get a VerticalFlowReference and add it to references
| Parameters | |
|---|---|
Object[] references |
where we add the VerticalFlowReference |
| Returns | |
|---|---|
FlowReference |
a VerticalFlowReference |
isBaselineNeeded
public boolean isBaselineNeeded(ConstraintWidget constraintWidget)
Does this constraintWidget need a baseline
| Returns | |
|---|---|
boolean |
true if the constraintWidget needs a baseline |
isRtl
public boolean isRtl()
Returns true if layout direction is right to left. False for left to right.
setDpToPixel
public void setDpToPixel(CorePixelDp dpToPixel)
Set the function that converts dp to Pixels