public interface Layout
Modifier and Type | Method and Description |
---|---|
float |
getMaxHeight()
Zero indicates no max height.
|
float |
getMaxWidth()
Zero indicates no max width.
|
float |
getMinHeight() |
float |
getMinWidth() |
float |
getPrefHeight() |
float |
getPrefWidth() |
void |
invalidate()
Invalidates this actor's layout, causing
layout() to happen the next time validate() is called. |
void |
invalidateHierarchy()
Invalidates this actor and its ascendants, calling
invalidate() on each. |
void |
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child,
calls
invalidate() on any each child whose width or height has changed, and calls validate() on each
child. |
void |
pack()
Sizes this actor to its preferred width and height, then calls
validate() . |
void |
setFillParent(boolean fillParent)
If true, this actor will be sized to the parent in
validate() . |
void |
setLayoutEnabled(boolean enabled)
Enables or disables the layout for this actor and all child actors, recursively.
|
void |
validate()
Ensures the actor has been laid out.
|
void layout()
invalidate()
on any each child whose width or height has changed, and calls validate()
on each
child. This method should almost never be called directly, instead validate()
should be used.void invalidate()
layout()
to happen the next time validate()
is called. This
method should be called when state changes in the actor that requires a layout but does not change the minimum, preferred,
maximum, or actual size of the actor (meaning it does not affect the parent actor's layout).void invalidateHierarchy()
invalidate()
on each. This method should be called when state
changes in the actor that affects the minimum, preferred, maximum, or actual size of the actor (meaning it potentially
affects the parent actor's layout).void validate()
layout()
if invalidate()
has been called since the last time
validate()
was called, or if the actor otherwise needs to be laid out. This method is usually called in
Actor.draw(Batch, float)
by the actor itself before drawing is performed.void pack()
validate()
.
Generally this method should not be called in an actor's constructor because it calls layout()
, which means a
subclass would have layout() called before the subclass' constructor. Instead, in constructors simply set the actor's size
to getPrefWidth()
and getPrefHeight()
. This allows the actor to have a size at construction time for more
convenient use with groups that do not layout their children.
void setFillParent(boolean fillParent)
validate()
. If the parent is the stage, the actor will be sized
to the stage. This method is for convenience only when the widget's parent does not set the size of its children (such as
the stage).void setLayoutEnabled(boolean enabled)
validate()
will not
cause a layout to occur. This can be useful when an actor will be manipulated externally, such as with actions. Default is
true.float getMinWidth()
float getMinHeight()
float getPrefWidth()
float getPrefHeight()
float getMaxWidth()
float getMaxHeight()