public class List extends Widget implements Cullable
ChangeListener.ChangeEvent
is fired when the list selection changes.
The preferred size of the list is determined by the text bounds of the items and the size of the List.ListStyle.selection
.
Modifier and Type | Class and Description |
---|---|
static class |
List.ListStyle
The style for a list, see
List . |
Constructor and Description |
---|
List(java.lang.Object[] items,
List.ListStyle style) |
List(java.lang.Object[] items,
Skin skin) |
List(java.lang.Object[] items,
Skin skin,
java.lang.String styleName) |
Modifier and Type | Method and Description |
---|---|
void |
draw(SpriteBatch batch,
float parentAlpha)
If this method is overridden, the super method or
Widget.validate() should be called to ensure the widget is laid out. |
float |
getItemHeight() |
java.lang.String[] |
getItems() |
float |
getPrefHeight() |
float |
getPrefWidth() |
int |
getSelectedIndex() |
java.lang.String |
getSelection() |
List.ListStyle |
getStyle()
Returns the list's style.
|
boolean |
isSelectable() |
void |
setCullingArea(Rectangle cullingArea) |
void |
setItems(java.lang.Object[] objects) |
void |
setSelectable(boolean selectable)
Sets whether this List's items are selectable.
|
void |
setSelectedIndex(int index) |
int |
setSelection(java.lang.String item)
Sets the selection to the item if found, else sets the selection to nothing.
|
void |
setStyle(List.ListStyle style) |
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, layout, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validate
act, addAction, addCaptureListener, addListener, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, fire, getActions, getCaptureListeners, getColor, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getWidth, getX, getY, getZIndex, hasParent, hit, isAscendantOf, isDescendantOf, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotate, scale, scale, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOriginX, setOriginY, setParent, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setVisible, setWidth, setX, setY, setZIndex, size, size, stageToLocalCoordinates, toBack, toFront, toString, translate
public List(java.lang.Object[] items, Skin skin)
public List(java.lang.Object[] items, Skin skin, java.lang.String styleName)
public List(java.lang.Object[] items, List.ListStyle style)
public void setSelectable(boolean selectable)
public boolean isSelectable()
public void setStyle(List.ListStyle style)
public List.ListStyle getStyle()
setStyle(ListStyle)
is called.public void draw(SpriteBatch batch, float parentAlpha)
Widget
Widget.validate()
should be called to ensure the widget is laid out.public int getSelectedIndex()
public void setSelectedIndex(int index)
index
- Set to -1 for nothing selected.public java.lang.String getSelection()
public int setSelection(java.lang.String item)
public void setItems(java.lang.Object[] objects)
public java.lang.String[] getItems()
public float getItemHeight()
public float getPrefWidth()
getPrefWidth
in interface Layout
getPrefWidth
in class Widget
public float getPrefHeight()
getPrefHeight
in interface Layout
getPrefHeight
in class Widget
public void setCullingArea(Rectangle cullingArea)
setCullingArea
in interface Cullable
cullingArea
- The culling area in the child actor's coordinates.