The preferred size of the label is determined by the actual text bounds, unless word wrap is enabled.
| Modifier and Type | Class and Description |
|---|---|
| public static class | Label.
The style for a label, see |
| Modifier and Type | Field and Description |
|---|---|
| private BitmapFontCache | |
| private String | |
| private boolean | |
| private float | |
| private float | |
| private int | |
| private Justify | |
| private int | |
| private float | |
| private final GlyphLayout | |
| private int | |
| private float | |
| private boolean | |
| private static final GlyphLayout | |
| private float | |
| private Label. | |
| private static final Color | |
| private final CharArray | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | Label(CharSequence text, Skin skin, String fontName, Color color)
Creates a label, using a |
| public | Label(CharSequence text, Skin skin, String fontName, String colorName)
Creates a label, using a |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public void | draw(Batch batch, float parentAlpha)
Overrides com. If this method is overridden, the super method or |
| protected BitmapFontCache | |
| public float | |
| public float | |
| public GlyphLayout | |
| public Justify | |
| public int | |
| public int | |
| public float | |
| public float | |
| public Label. | getStyle()
Implements com. Returns the label's style. |
| public CharArray | |
| public boolean | |
| public void | invalidate()
Overrides com. Implements com. Invalidates this actor's layout, causing |
| public void | layout()
Overrides com. Implements com. Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child,
calls |
| private void | |
| public void | setAlignment(int
Aligns all the text within the label (default left center) and each line of text horizontally (default
left). alignment)
|
| public void | setAlignment(int
Aligns all the text within the label (default left center). labelAlign, int Aligns each line of text horizontally (default left). lineAlign)
|
| public void | setEllipsis(String ellipsis)
When non-null the text will be truncated "..." if it does not fit within the width of the label. |
| public void | setEllipsis(boolean ellipsis)
When true the text will be truncated "..." if it does not fit within the width of the label. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setStyle(Label.
Implements com. Set the current style of the actor |
| public boolean | Returns: true if the text was changed.Sets the text to the specified integer value. |
| public void | |
| public void | |
| public boolean | |
| public String | toString()
Overrides com. Returns a string representation of the object. |
| cache | back to summary |
|---|---|
| private BitmapFontCache cache | |
| ellipsis | back to summary |
|---|---|
| private String ellipsis
| |
| fontScaleChanged | back to summary |
|---|---|
| private boolean fontScaleChanged | |
| fontScaleX | back to summary |
|---|---|
| private float fontScaleX | |
| fontScaleY | back to summary |
|---|---|
| private float fontScaleY | |
| intValue | back to summary |
|---|---|
| private int intValue | |
| justify | back to summary |
|---|---|
| private Justify justify | |
| labelAlign | back to summary |
|---|---|
| private int labelAlign | |
| lastPrefHeight | back to summary |
|---|---|
| private float lastPrefHeight | |
| layout | back to summary |
|---|---|
| private final GlyphLayout layout | |
| lineAlign | back to summary |
|---|---|
| private int lineAlign | |
| prefHeight | back to summary |
|---|---|
| private float prefHeight | |
| prefSizeInvalid | back to summary |
|---|---|
| private boolean prefSizeInvalid | |
| prefSizeLayout | back to summary |
|---|---|
| private static final GlyphLayout prefSizeLayout | |
| prefWidth | back to summary |
|---|---|
| private float prefWidth | |
| style | back to summary |
|---|---|
| private Label. | |
| tempColor | back to summary |
|---|---|
| private static final Color tempColor | |
| text | back to summary |
|---|---|
| private final CharArray text | |
| wrap | back to summary |
|---|---|
| private boolean wrap | |
| Label | back to summary |
|---|---|
| public Label(CharSequence text, Skin skin) | |
| Label | back to summary |
|---|---|
| public Label(CharSequence text, Skin skin, String styleName) | |
| Label | back to summary |
|---|---|
| public Label(CharSequence text, Skin skin, String fontName, Color color) Creates a label, using a | |
| Label | back to summary |
|---|---|
| public Label(CharSequence text, Skin skin, String fontName, String colorName) Creates a label, using a | |
| Label | back to summary |
|---|---|
| public Label(CharSequence text, Label. | |
| computePrefSize | back to summary |
|---|---|
| protected void computePrefSize(GlyphLayout layout) | |
| draw | back to summary |
|---|---|
| public void draw(Batch batch, float parentAlpha) Overrides com. Doc from com. If this method is overridden, the super method or | |
| getBitmapFontCache | back to summary |
|---|---|
| protected BitmapFontCache getBitmapFontCache() Allows subclasses to access the cache in | |
| getFontScaleX | back to summary |
|---|---|
| public float getFontScaleX() | |
| getFontScaleY | back to summary |
|---|---|
| public float getFontScaleY() | |
| getGlyphLayout | back to summary |
|---|---|
| public GlyphLayout getGlyphLayout() | |
| getJustify | back to summary |
|---|---|
| public Justify getJustify() | |
| getLabelAlign | back to summary |
|---|---|
| public int getLabelAlign() | |
| getLineAlign | back to summary |
|---|---|
| public int getLineAlign() | |
| getPrefHeight | back to summary |
|---|---|
| public float getPrefHeight() Overrides com. Implements com. | |
| getPrefWidth | back to summary |
|---|---|
| public float getPrefWidth() Overrides com. Implements com. | |
| getStyle | back to summary |
|---|---|
| public Label. Implements com. Returns the label's style. Modifying the returned style may not have an effect until | |
| getText | back to summary |
|---|---|
| public CharArray getText() | |
| getWrap | back to summary |
|---|---|
| public boolean getWrap() | |
| invalidate | back to summary |
|---|---|
| public void invalidate() Overrides com. Implements com. Doc from com. Invalidates this actor's layout, causing | |
| layout | back to summary |
|---|---|
| public void layout() Overrides com. Implements com. Doc from com. Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child,
calls | |
| scaleAndComputePrefSize | back to summary |
|---|---|
| private void scaleAndComputePrefSize() | |
| setAlignment | back to summary |
|---|---|
public void setAlignment(int alignment)
| |
| setAlignment | back to summary |
|---|---|
public void setAlignment(int labelAlign, int lineAlign)
| |
| setEllipsis | back to summary |
|---|---|
| public void setEllipsis(String ellipsis) When non-null the text will be truncated "..." if it does not fit within the width of the label. Wrapping will not occur when ellipsis is enabled. Default is false. | |
| setEllipsis | back to summary |
|---|---|
| public void setEllipsis(boolean ellipsis) When true the text will be truncated "..." if it does not fit within the width of the label. Wrapping will not occur when ellipsis is true. Default is false. | |
| setFontScale | back to summary |
|---|---|
| public void setFontScale(float fontScale) | |
| setFontScale | back to summary |
|---|---|
| public void setFontScale(float fontScaleX, float fontScaleY) | |
| setFontScaleX | back to summary |
|---|---|
| public void setFontScaleX(float fontScaleX) | |
| setFontScaleY | back to summary |
|---|---|
| public void setFontScaleY(float fontScaleY) | |
| setJustify | back to summary |
|---|---|
| public void setJustify(Justify justify) | |
| setStyle | back to summary |
|---|---|
| public void setStyle(Label. Implements com. Doc from com. Set the current style of the actor | |
| setText | back to summary |
|---|---|
| public boolean setText(int value) Sets the text to the specified integer value. If the text is already equivalent to the specified value, a string is not allocated.
| |
| setText | back to summary |
|---|---|
public void setText(CharSequence newText)
| |
| setWrap | back to summary |
|---|---|
| public void setWrap(boolean wrap) If false, the text will only wrap where it contains newlines (\n). The preferred size of the label will be the text bounds. If true, the text will word wrap using the width of the label. The preferred width of the label will be 0, it is expected that something external will set the width of the label. Wrapping will not occur when ellipsis is enabled. Default is false. When wrap is enabled, the label's preferred height depends on the width of the label. In some cases the parent of the label will need to layout twice: once to set the width of the label and a second time to adjust to the label's new preferred height. | |
| textEquals | back to summary |
|---|---|
| public boolean textEquals(CharSequence other) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides com. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
Label.
| Modifier and Type | Field and Description |
|---|---|
| public Drawable | |
| public BitmapFont | |
| public Color |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| background | back to summary |
|---|---|
| public Drawable background
| |
| font | back to summary |
|---|---|
| public BitmapFont font | |
| fontColor | back to summary |
|---|---|
| public Color fontColor
| |
| LabelStyle | back to summary |
|---|---|
| public LabelStyle() | |
| LabelStyle | back to summary |
|---|---|
| public LabelStyle(BitmapFont font, Color fontColor) | |
| LabelStyle | back to summary |
|---|---|
| public LabelStyle(Label. | |