public class Slider extends ProgressBar
ChangeListener.ChangeEvent is fired when the slider knob is moved. Canceling the event will move the knob to where it was previously.
For a horizontal progress bar, its preferred height is determined by the larger of the knob and background, and the preferred width is 140, a relatively arbitrary size. These parameters are reversed for a vertical progress bar.
| Modifier and Type | Class and Description |
|---|---|
static class |
Slider.SliderStyle
The style for a slider, see
Slider. |
ProgressBar.ProgressBarStyle| Constructor and Description |
|---|
Slider(float min,
float max,
float stepSize,
boolean vertical,
Skin skin) |
Slider(float min,
float max,
float stepSize,
boolean vertical,
Skin skin,
java.lang.String styleName) |
Slider(float min,
float max,
float stepSize,
boolean vertical,
Slider.SliderStyle style)
Creates a new slider.
|
| Modifier and Type | Method and Description |
|---|---|
protected Drawable |
getKnobDrawable() |
Slider.SliderStyle |
getStyle()
Returns the slider's style.
|
boolean |
isDragging()
Returns true if the slider is being dragged.
|
void |
setSnapToValues(float[] values,
float threshold)
Will make this progress bar snap to the specified values, if the knob is within the threshold.
|
void |
setStyle(Slider.SliderStyle style) |
void |
setVisualInterpolationInverse(Interpolation interpolation)
Sets the inverse interpolation to use for display.
|
protected float |
snap(float value)
Returns a snapped value.
|
act, clamp, draw, getKnobPosition, getMaxValue, getMinValue, getPercent, getPrefHeight, getPrefWidth, getStepSize, getValue, getVisualPercent, getVisualValue, isDisabled, isVertical, setAnimateDuration, setAnimateInterpolation, setDisabled, setRange, setRound, setStepSize, setStyle, setValue, setVisualInterpolationgetMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, layout, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateaddAction, addCaptureListener, addListener, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasParent, hit, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront, toStringpublic Slider(float min,
float max,
float stepSize,
boolean vertical,
Skin skin)
public Slider(float min,
float max,
float stepSize,
boolean vertical,
Skin skin,
java.lang.String styleName)
public Slider(float min,
float max,
float stepSize,
boolean vertical,
Slider.SliderStyle style)
NinePatch or slider handle TextureRegion. The min and max values determine
the range the values of this slider can take on, the stepSize parameter specifies the distance between individual values.
E.g. min could be 4, max could be 10 and stepSize could be 0.2, giving you a total of 30 values, 4.0 4.2, 4.4 and so on.min - the minimum valuemax - the maximum valuestepSize - the step size between valuesstyle - the Slider.SliderStylepublic void setStyle(Slider.SliderStyle style)
public Slider.SliderStyle getStyle()
setStyle(SliderStyle) is
called.getStyle in class ProgressBarprotected Drawable getKnobDrawable()
getKnobDrawable in class ProgressBarprotected float snap(float value)
public void setSnapToValues(float[] values,
float threshold)
values - May be null.public boolean isDragging()
public void setVisualInterpolationInverse(Interpolation interpolation)
visual interpolation.