WidgetContainer
public class WidgetContainer extends ConstraintWidget
| java.lang.Object | ||
| ↳ | androidx.constraintlayout.core.widgets.ConstraintWidget | |
| ↳ | androidx.constraintlayout.core.widgets.WidgetContainer |
ConstraintWidgetContainer |
A container of ConstraintWidget that can layout its children |
A container of ConstraintWidget
Summary
Public fields |
|
|---|---|
ArrayList<ConstraintWidget> |
Public constructors |
|---|
|
Default constructor |
WidgetContainer(int width, int height)Constructor |
WidgetContainer(int x, int y, int width, int height)Constructor |
Public methods |
|
|---|---|
void |
add(ConstraintWidget widget)Add a child widget |
void |
add(ConstraintWidget[] widgets)Add multiple child widgets. |
ArrayList<ConstraintWidget> |
Access the children |
ConstraintWidgetContainer |
Return the top-level ConstraintWidgetContainer |
void |
layout()Function implemented by ConstraintWidgetContainer |
void |
remove(ConstraintWidget widget)Remove a child widget |
void |
|
void |
reset() |
void |
resetSolverVariables(Cache cache)Reset the solver variables of the anchors |
void |
setOffset(int x, int y)Set the offset of this widget relative to the root widget. |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited fields |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public fields
Public constructors
WidgetContainer
public WidgetContainer(int width, int height)
Constructor
| Parameters | |
|---|---|
int width |
width of the layout |
int height |
height of the layout |
WidgetContainer
public WidgetContainer(int x, int y, int width, int height)
Constructor
| Parameters | |
|---|---|
int x |
x position |
int y |
y position |
int width |
width of the layout |
int height |
height of the layout |
Public methods
add
public void add(ConstraintWidget widget)
Add a child widget
| Parameters | |
|---|---|
ConstraintWidget widget |
to add |
add
public void add(ConstraintWidget[] widgets)
Add multiple child widgets.
| Parameters | |
|---|---|
ConstraintWidget[] widgets |
to add |
getChildren
public ArrayList<ConstraintWidget> getChildren()
Access the children
| Returns | |
|---|---|
ArrayList<ConstraintWidget> |
the array of children |
getRootConstraintContainer
public ConstraintWidgetContainer getRootConstraintContainer()
Return the top-level ConstraintWidgetContainer
| Returns | |
|---|---|
ConstraintWidgetContainer |
top-level ConstraintWidgetContainer |
remove
public void remove(ConstraintWidget widget)
Remove a child widget
| Parameters | |
|---|---|
ConstraintWidget widget |
to remove |
resetSolverVariables
public void resetSolverVariables(Cache cache)
Reset the solver variables of the anchors
setOffset
public void setOffset(int x, int y)
Set the offset of this widget relative to the root widget. We then set the offset of our children as well.
| Parameters | |
|---|---|
int x |
horizontal offset |
int y |
vertical offset |