public class Slider extends AbsSlider
You can change the progress of an event, for example, to fast-forward music playback. If
the Slider is used to indicate the completion state of a task, the slider cannot be
dragged on the screen.
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static interface |
Slider.ValueChangedListener |
Provides callbacks to listen for and process change events of a
Slider. |
AbsSlider.FormatterComponent.BindStateChangedListener, Component.CanAcceptScrollListener, Component.ClickedListener, Component.ComponentStateChangedListener, Component.ContourRefreshedListener, Component.DefSpeechEventListener, Component.DoubleClickedListener, Component.DragFeedbackProvider, Component.DraggedListener, Component.DrawTask, Component.EditEventListener, Component.EstimateSizeListener, Component.EstimateSpec, Component.FadeEffectEnum, Component.FocusChangedListener, Component.ForwardHoverListener, Component.ForwardTouchListener, Component.GestureType, Component.HoverEventListener, Component.KeyEventListener, Component.LayoutDirection, Component.LayoutRefreshedListener, Component.LongClickedListener, Component.MeasureSpec, Component.MouseEventListener, Component.MousePointerStyleListener, Component.OnDragListener, Component.RotationEventListener, Component.ScaledListener, Component.ScrolledListener, Component.ShadowDevice, Component.ShadowMode, Component.ShadowSize, Component.SpeechEventListener, Component.TouchEventListener, Component.UnconsumedKeyEventListener, Component.VoiceEventProgressBar.BarObserver| 限定符和类型 | 字段 | 说明 |
|---|---|---|
protected Slider.ValueChangedListener |
mValueChangedListener |
Indicates a listener to receive notifications of progress level changes.
|
ACCESSIBILITY_ADAPTABLE, ACCESSIBILITY_DISABLE, ACCESSIBILITY_ENABLE, AXIS_X, AXIS_Y, CONTOUR_BACKGROUND, CONTOUR_BORDER, CONTOUR_PADDING_BORDER, DEFAULT_SCALE, DRAG_DOWN, DRAG_HORIZONTAL, DRAG_HORIZONTAL_VERTICAL, DRAG_LEFT, DRAG_RIGHT, DRAG_UP, DRAG_VERTICAL, EVENT_TYPE_COMPONENT_ACCESSIBILITY_FOCUSED, EVENT_TYPE_COMPONENT_ACCESSIBILITY_FOCUSED_CLEAR, EVENT_TYPE_COMPONENT_CLICKED, EVENT_TYPE_COMPONENT_FOCUSED, EVENT_TYPE_COMPONENT_LONG_CLICKED, EVENT_TYPE_COMPONENT_SCROLLED, EVENT_TYPE_COMPONENT_SELECTED, EVENT_TYPE_COMPONENT_TEXT_UPDATE, EVENT_TYPE_NOTICE, EVENT_TYPE_NOTIFICATION_STATE_UPDATE, EVENT_TYPE_TOAST_SHOW, EVENT_TYPE_WINDOW_STATE_UPDATE, FOCUS_ADAPTABLE, FOCUS_DISABLE, FOCUS_ENABLE, FOCUS_NEXT, FOCUS_PREVIOUS, FOCUS_SIDE_BOTTOM, FOCUS_SIDE_LEFT, FOCUS_SIDE_RIGHT, FOCUS_SIDE_TOP, HIDE, HORIZONTAL, ID_DEFAULT, INHERITED_MODE, INVISIBLE, mBackgroundElement, mCanvasForTaskOverContent, mCanvasForTaskUnderContent, mComponentParent, mContext, mDrawTaskOverContent, mDrawTaskUnderContent, mEstimateSizeListener, mForegroundElement, mForwardHoverListener, mHoverEventListener, mKeyEventListener, mMouseEventListener, mPosition, mRotationEventListener, mShadowElement, mUnconsumedKeyEventListener, OVAL_MODE, OVAL_SCROLL_BAR_MODE, POSITION_X_INDEX, POSITION_Y_INDEX, RECT_MODE, RECT_SCROLL_BAR_MODE, SCROLL_AUTO_STAGE, SCROLL_IDLE_STAGE, SCROLL_NORMAL_STAGE, UNSPECIFIED_SCROLL_BAR_MODE, VERTICAL, VISIBLE| 构造器 | 说明 |
|---|---|
Slider(Context context) |
Default constructor used to create a
Slider instance by using the default attribute set and style. |
Slider(Context context,
AttrSet attrSet) |
A constructor used to create a
Slider instance by using specified attribute set and default style
after the XML file is parsed. |
Slider(Context context,
AttrSet attrSet,
String styleName) |
A constructor used to create a
Slider instance by using specified attribute set and specified style
after the XML file is parsed. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
Element[] |
getAdjustButtonsElements() |
Obtains the
Element objects of all increase and decrease buttons. |
Element |
getDecreaseButton() |
Obtains the object used to draw a decrease button.
|
Component.ClickedListener |
getDecreaseButtonClickedListener() |
Obtains the listener for the decrease button.
|
Element |
getIncreaseButton() |
Obtains the object used to draw an increase button.
|
Component.ClickedListener |
getIncreaseButtonClickedListener() |
Obtains the listener for the increase button.
|
Element |
getThumbElement() |
Obtains the current element thumb.
|
Slider.ValueChangedListener |
getValueChangedListener() |
Obtains the the listener for monitoring change events of this
Slider. |
void |
setAdjustButtons(Element increaseElement,
Component.ClickedListener increaseListener,
Element decreaseElement,
Component.ClickedListener decreaseListener) |
Sets increase and decrease buttons for this
Slider. |
void |
setDecreaseButton(Element element,
Component.ClickedListener listener) |
Sets a decrease button for this slider.
|
void |
setDecreaseButtonClickedListener(Component.ClickedListener listener) |
Sets a listener for the decrease button of this
Slider. |
void |
setDecreaseButtonElement(Element element) |
Sets a decrease button for this
Slider. |
void |
setIncreaseButton(Element element,
Component.ClickedListener listener) |
Sets an increase button for this slider.
|
void |
setIncreaseButtonClickedListener(Component.ClickedListener listener) |
Sets a listener for the increase button of this
Slider. |
void |
setIncreaseButtonElement(Element element) |
Sets an increase button for this
Slider. |
void |
setThumbElement(Element element) |
Sets an element thumb.
|
void |
setValueChangedListener(Slider.ValueChangedListener listener) |
Sets a listener to listen for change events of a slider.
|
getFormatter, setFormatteraddDrawTask, addDrawTask, addScrolledListener, announceAccessibility, arrange, bindCornerMark, callOnClick, canScroll, clearFocus, createAnimatorProperty, disableFadeEffect, dispatchRestoreState, dispatchSaveState, draw, enableCornerMark, enableFadeEffect, enableSaveState, enableScrollBar, estimateSize, executeDoubleClick, executeLongClick, findComponentById, findComponentHolderById, findFocus, findNextFocusableComponent, findRequestNextFocus, getAccessibility, getAccessibilityDescription, getAlpha, getAltitude, getBackgroundElement, getBaseLine, getBottom, getBoundaryFadeEffectBottomRate, getBoundaryFadeEffectLeftRate, getBoundaryFadeEffectRightRate, getBoundaryFadeEffectTopRate, getCenterZoomFactor, getCentralScrollMode, getClickedListener, getClipEnabled, getComponentDescription, getComponentMinSize, getComponentParent, getComponentPosition, getComponentSize, getComponentStateChangedListener, getComponentTreeObserver, getContentEnable, getContentPosition, getContentPositionX, getContentPositionY, getContext, getContour, getContourRefreshedListener, getCornerMark, getDragAcceptAngle, getDraggedListener, getEditEventListener, getEstimatedHeight, getEstimatedWidth, getFadeEffectBoundaryWidth, getFadeEffectColor, getFocusable, getFocusBorderEnable, getFocusBorderPadding, getFocusBorderRadius, getFocusBorderWidth, getForegroundElement, getForegroundGravity, getForwardHoverListener, getForwardTouchListener, getGesturePriority, getHeight, getHorizontalPadding, getHorizontalPosition, getHoverEventListener, getId, getKeyEventListener, getLayoutConfig, getLayoutDirection, getLayoutDirectionResolved, getLayoutRefreshedListener, getLeft, getLocationOnScreen, getMarginBottom, getMarginLeft, getMarginRight, getMargins, getMarginsLeftAndRight, getMarginsTopAndBottom, getMarginTop, getMatrix, getMinHeight, getMinWidth, getMode, getModeResolved, getMouseEventListener, getMousePointerStyleListener, getName, getPadding, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getPivot, getPivotX, getPivotY, getResourceManager, getRight, getRotation, getRotationEventListener, getRotationSensitivity, getScale, getScaledListener, getScaleX, getScaleY, getScrollbarBackgroundColor, getScrollbarColor, getScrollbarFadingDelay, getScrollbarFadingDuration, getScrollBarMode, getScrollbarRadius, getScrollbarRoundRect, getScrollbarStartAngle, getScrollbarSweepAngle, getScrollbarThickness, getScrollState, getScrollValue, getSelfVisibleRect, getShadowColor, getSpeechEventListener, getTag, getTop, getTouchEventListener, getTransitionSymbol, getTranslation, getTranslationX, getTranslationY, getTranslationZ, getUserNextFocus, getVerticalPadding, getVerticalPosition, getVisibility, getVisibleRectOnScreen, getWidth, getWindowVisibleRect, hasFocus, hasFocusedEffect, hasOverlaps, hideFocusBorder, informConfigurationChanged, invalidate, isBoundaryFadeEffectEnable, isBoundToWindow, isClickable, isClipToContourEnabled, isComponentDisplayed, isEnabled, isFadeEffected, isFocusable, isFocused, isIdentityMatrix, isLongClickOn, isPressed, isRtl, isSaveStateEnabled, isScrollbarFadingOn, isScrollBarOn, isScrollbarOverlapEnabled, isSelected, isSoundEnable, isTouchFocusable, isVibrationEffectEnabled, notifyAccessibility, onAttributeConfigChanged, onDrag, onRestoreState, onRtlChanged, onSaveState, performScale, playSound, postLayout, refreshContour, release, removeBindStateChangedListener, removeScrolledListener, requestFocus, requestForceForwardTouchEvent, restoreComponentTreeState, saveComponentTreeState, scrollBy, scrollTo, setAccessibility, setAccessibilityDescription, setAlpha, setAltitude, setBackground, setBindStateChangedListener, setBottom, setBoundaryFadeEffectEnable, setCanAcceptScrollListener, setCenterZoomFactor, setCentralScrollMode, setClickable, setClickedListener, setClipEnabled, setClipToContourEnabled, setComponentDescription, setComponentMinSize, setComponentPosition, setComponentPosition, setComponentSize, setComponentStateChangedListener, setContentEnable, setContentPosition, setContentPositionX, setContentPositionY, setContour, setContourRefreshedListener, setDoubleClickedListener, setDragAcceptAngle, setDraggedListener, setEditEventListener, setEnabled, setEstimatedSize, setEstimateSizeListener, setFadeEffectBoundaryWidth, setFadeEffectColor, setFocusable, setFocusBorderEnable, setFocusBorderPadding, setFocusBorderRadius, setFocusBorderRadius, setFocusBorderWidth, setFocusChangedListener, setFocusedEffect, setForeground, setForegroundGravity, setForwardHoverListener, setForwardTouchListener, setGesturePriority, setHeight, setHorizontalPadding, setHorizontalPosition, setHoverEventListener, setId, setKeyEventListener, setLayoutConfig, setLayoutDirection, setLayoutRefreshedListener, setLeft, setLongClickable, setLongClickedListener, setMarginBottom, setMarginLeft, setMarginRight, setMarginsLeftAndRight, setMarginsTopAndBottom, setMarginTop, setMinHeight, setMinWidth, setMode, setMouseEventListener, setMousePointerStyleListener, setName, setOnDragListener, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRelative, setPaddingRight, setPaddingTop, setPivot, setPivot, setPivotX, setPivotY, setPosition, setPositionX, setPositionY, setPressState, setRight, setRotation, setRotationEventListener, setRotationSensitivity, setScale, setScaledListener, setScaleX, setScaleY, setScrollbarBackgroundColor, setScrollbarColor, setScrollbarFadingDelay, setScrollbarFadingDuration, setScrollbarFadingEnabled, setScrollBarMode, setScrollbarOverlapEnabled, setScrollbarRadius, setScrollbarRoundRect, setScrollbarStartAngle, setScrollbarSweepAngle, setScrollbarThickness, setScrolledListener, setSelected, setShadowColor, setShadowStyle, setSoundEnable, setSpeechEventListener, setTag, setTop, setTouchEventListener, setTouchFocusable, setTransitionSymbol, setTranslation, setTranslationX, setTranslationY, setTranslationZ, setUnconsumedKeyEventListener, setUserNextFocus, setVerticalPadding, setVerticalPosition, setVibrationEffectEnabled, setVisibility, setWidth, showFocusBorder, simulateClick, simulateDrag, startDragAndDrop, subscribeVoiceEvents, unsubscribeVoiceEventsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddBarObserver, enableDividerLines, getBackgroundInstructElement, getDividerLineColor, getDividerLinesNumber, getDividerLineThickness, getInfiniteModeElement, getMax, getMaxHeight, getMaxWidth, getMin, getOrientation, getProgress, getProgressColor, getProgressColors, getProgressElement, getProgressHintText, getProgressHintTextAlignment, getProgressHintTextColor, getProgressHintTextSize, getProgressWidth, getStep, getViceProgressElement, getViceProgressValue, isDividerLinesEnabled, isIndeterminate, isInfiniteMode, removeBarObserver, setDividerLineColor, setDividerLinesNumber, setDividerLineThickness, setIndeterminate, setInfiniteModeElement, setMaxHeight, setMaxValue, setMaxWidth, setMinValue, setOrientation, setProgressBackgroundElement, setProgressColor, setProgressColors, setProgressElement, setProgressHintText, setProgressHintTextAlignment, setProgressHintTextColor, setProgressHintTextSize, setProgressValue, setProgressWidth, setStep, setViceProgress, setViceProgressElementprotected Slider.ValueChangedListener mValueChangedListener
ValueChangedListener stores the slider change listener and provides the
callback to process change events of the slider.
public Slider(Context context)
Slider instance by using the default attribute set and style.context - Indicates the application context.public Slider(Context context, AttrSet attrSet)
Slider instance by using specified attribute set and default style
after the XML file is parsed.context - Indicates the application context.attrSet - Indicates the attribute set to be used.public Slider(Context context, AttrSet attrSet, String styleName)
Slider instance by using specified attribute set and specified style
after the XML file is parsed.context - Indicates the application context.attrSet - Indicates the attribute set to be used.styleName - Indicates the style name to use.public void setValueChangedListener(Slider.ValueChangedListener listener)
For example, the listener listens for the event when touching the slider or dragging it to change the current progress level.
listener - Indicates the listener.Slider.ValueChangedListenerpublic Slider.ValueChangedListener getValueChangedListener()
Slider.public void setIncreaseButton(Element element, Component.ClickedListener listener)
The increase button is located on the top of a vertical slider or on the right of a horizontal slider.
element - Indicates the element object of the increase button.listener - Indicates the increase button listener. If this parameter is null, the default increase button
listener will be used.public void setIncreaseButtonElement(Element element)
Slider.element - Indicates the Element object for the increase button.public void setIncreaseButtonClickedListener(Component.ClickedListener listener)
Slider.listener - Indicates the listener to set. If this parameter is null,
the default listener is used for the increase button.public Component.ClickedListener getIncreaseButtonClickedListener()
public Element getIncreaseButton()
public void setDecreaseButton(Element element, Component.ClickedListener listener)
The decrease button is located at the bottom of a vertical slider or on the left of a horizontal slider.
element - Indicates the element object of the decrease button.listener - Indicates the decrease button listener. If this parameter is null, the default decrease button
listener will be used.public void setDecreaseButtonElement(Element element)
Slider.element - Indicates the Element object for the decrease button.public void setDecreaseButtonClickedListener(Component.ClickedListener listener)
Slider.listener - Indicates the listener to set. If this parameter is null,
the default listener is used for the decrease button.public Component.ClickedListener getDecreaseButtonClickedListener()
public Element getDecreaseButton()
public void setAdjustButtons(Element increaseElement, Component.ClickedListener increaseListener, Element decreaseElement, Component.ClickedListener decreaseListener)
Slider.
The increase button is located at the top of a vertical slider or on the right of a horizontal slider; the decrease button is located at the bottom of a vertical slider or on the left side of a horizontal slider.
increaseElement - Indicates the Element object for the increase button.increaseListener - Indicates the listener for the increase button. If this parameter is null, the default
listener is used for the increase button.decreaseElement - Indicates the Element object for the decrease button.decreaseListener - Indicates the listener for the decrease button. If this parameter is null, the default
listener is used for the decrease button.public Element[] getAdjustButtonsElements()
Element objects of all increase and decrease buttons.Element objects.public Element getThumbElement()
AbsSlidergetThumbElement 在类中 AbsSliderpublic void setThumbElement(Element element)
AbsSlidersetThumbElement 在类中 AbsSliderelement - Indicates the element thumb.