ComponentParentpublic class SlideDrawer extends ComponentContainer
SlideDrawer item.
This class allows for the display of the main component while hiding the set of its four optional components related to different directions (start, top, end, and bottom). To show an optional component, the end user needs to slide from the corresponding direction.
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
SlideDrawer.DisplayMode |
Enumerates the modes for the optional components to display.
|
static class |
SlideDrawer.DrawerState |
Enumerates the possible states for
SlideDrawer. |
static class |
SlideDrawer.LayoutConfig |
Configures layout parameters of
SlideDrawer, including the width, height, margin,
SlideDirection, and DisplayMode. |
static class |
SlideDrawer.SlideDirection |
Enumerates the directions of the optional components relative to the main component.
|
static interface |
SlideDrawer.SlideDisable |
Allows for disabling slides in real time.
|
static interface |
SlideDrawer.SlideListener |
Listens for
SlideDrawer state changes. |
Component.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.VoiceEventComponentContainer.ArrangeListener| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static SlideDrawer.DisplayMode |
DEFAULT_DISPLAY_MODE |
Indicates the default value for
DisplayMode. |
static float |
DEFAULT_OPEN_THRESHOLD |
Indicates the default percent value after which the optional component can be slid open.
|
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, VISIBLEFOCUS_CHILDREN_FIRST, FOCUS_CHILDREN_HIDE, FOCUS_PARENT_FIRST, mArrangeListener| 构造器 | 说明 |
|---|---|
SlideDrawer(Context context) |
Default constructor used to create a
SlideDrawer instance by using the default attribute set and default
style. |
SlideDrawer(Context context,
AttrSet attrSet) |
A constructor used to create a
SlideDrawer instance by using the specified attribute set and default
style after the XML file is parsed. |
SlideDrawer(Context context,
AttrSet attrSet,
String styleName) |
A constructor used to create a
SlideDrawer instance by using the specified attribute set and specified
style after the XML file is parsed. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addSlideDisable(SlideDrawer.SlideDisable callback) |
Adds a callback that allows for the disabling of a slide event in real time.
|
void |
addSlideListener(SlideDrawer.SlideListener listener) |
Adds a slide listener.
|
boolean |
close() |
Closes the
SlideDrawer if the current state is DrawerState#OPEN. |
boolean |
close(SlideDrawer.SlideDirection direction) |
Closes the
SlideDrawer in a certain direction if its current state is DrawerState#OPEN
and the direction parameter equals the value returned by getSlideDirection(). |
boolean |
closeSmoothly() |
Closes the
SlideDrawer smoothly if its current state is DrawerState#OPEN. |
boolean |
closeSmoothly(int interval) |
Closes the
SlideDrawer smoothly if its current state is DrawerState#OPEN. |
boolean |
closeSmoothly(SlideDrawer.SlideDirection direction) |
Closes the
SlideDrawer smoothly in a certain direction if its current state is DrawerState#OPEN
and the direction parameter equals the value returned by getSlideDirection(). |
boolean |
closeSmoothly(SlideDrawer.SlideDirection direction,
int interval) |
Closes the
SlideDrawer smoothly in a certain direction if its current state is DrawerState#OPEN
and the direction parameter equals the value returned by getSlideDirection(). |
ComponentContainer.LayoutConfig |
createLayoutConfig(Context context,
AttrSet attrSet) |
Creates layout parameters using the attribute set of a child component.
|
SlideDrawer.DisplayMode[] |
getDisplayMode() |
Obtains the display modes for the optional components for all directions.
|
SlideDrawer.DisplayMode |
getDisplayMode(SlideDrawer.SlideDirection direction) |
Obtains the display mode for the optional components for a certain direction.
|
float |
getOpenThreshold() |
Obtains the percent value after which the optional component can be slid open.
|
SlideDrawer.SlideDirection |
getSlideDirection() |
Obtains the current
SlideDrawer direction. |
int |
getSlideDistance(SlideDrawer.SlideDirection direction) |
Obtains the maximum sliding distance for a certain direction.
|
float |
getSlideDistanceRatio() |
Obtains the current sliding percent from the start position.
|
SlideDrawer.DrawerState |
getSlideState() |
Obtains the current
SlideDrawer state. |
boolean |
hasSlideDisables() |
Checks whether any disable callback is stored in
SlideDrawer. |
boolean |
hasSlideListeners() |
Checks whether any listener is stored in
SlideDrawer. |
boolean |
isSlideEnabled() |
Checks whether the slide gesture is enabled.
|
boolean |
isTouchForClose() |
Checks whether the
SlideDrawer can be closed by a touch. |
boolean |
open() |
Opens the
SlideDrawer if SlideDrawer contains the optional component only for the
single direction). |
boolean |
open(SlideDrawer.SlideDirection direction) |
Opens the
SlideDrawer in a certain direction if its current state is DrawerState#CLOSE. |
boolean |
openSmoothly() |
Opens the
SlideDrawer smoothly if SlideDrawer contains the optional component only for the
single direction). |
boolean |
openSmoothly(int interval) |
Opens the
SlideDrawer smoothly if SlideDrawer contains the optional component only for the
single direction). |
boolean |
openSmoothly(SlideDrawer.SlideDirection direction) |
Opens the
SlideDrawer smoothly in a certain direction if its current state is DrawerState#CLOSE. |
boolean |
openSmoothly(SlideDrawer.SlideDirection direction,
int interval) |
Opens the
SlideDrawer smoothly in a certain direction if its current state is DrawerState#CLOSE. |
void |
removeAllSlideDisables() |
Removes all callbacks that allow for the disabling of slide events in real time.
|
void |
removeAllSlideListeners() |
Removes all slide listeners.
|
void |
removeComponents(int start,
int count) |
Removes all components from specified positions in a component list.
|
void |
removeSlideDisable(SlideDrawer.SlideDisable callback) |
Removes a callback that allows for the disabling of a slide event in real time.
|
void |
removeSlideListener(SlideDrawer.SlideListener listener) |
Removes a slide listener.
|
void |
setDisplayMode(SlideDrawer.DisplayMode mode) |
Sets a display mode for all the optional components.
|
void |
setDisplayMode(SlideDrawer.DisplayMode startMode,
SlideDrawer.DisplayMode topMode,
SlideDrawer.DisplayMode endMode,
SlideDrawer.DisplayMode bottomMode) |
Sets different display modes for all directions.
|
void |
setDisplayMode(SlideDrawer.DisplayMode mode,
SlideDrawer.SlideDirection direction) |
Sets the display mode for the optional components from a certain direction.
|
void |
setMaximumSlideDistance(int max) |
Sets the maximum sliding distance.
|
void |
setOpenThreshold(float percent) |
Sets the percent value after which the optional component can be slid open.
|
void |
setSlideEnabled(boolean isEnabled) |
Sets whether the
SlideDrawer can be slid by users. |
void |
setTouchForClose(boolean isEnabled) |
Sets whether the
SlideDrawer can be closed by a touch. |
boolean |
toggle() |
|
boolean |
toggle(SlideDrawer.SlideDirection direction) |
Switches the
SlideDrawer states between DrawerState#OPEN and DrawerState#CLOSE in a
certain direction. |
boolean |
toggleSmoothly() |
|
boolean |
toggleSmoothly(int interval) |
|
boolean |
toggleSmoothly(SlideDrawer.SlideDirection direction) |
Switches the
SlideDrawer states between DrawerState#OPEN and DrawerState#CLOSE smoothly
in a certain direction. |
boolean |
toggleSmoothly(SlideDrawer.SlideDirection direction,
int interval) |
Switches the
SlideDrawer states between DrawerState#OPEN and DrawerState#CLOSE smoothly
in a certain direction. |
ComponentContainer.LayoutConfig |
verifyLayoutConfig(ComponentContainer.LayoutConfig config) |
Verifies layout parameters based on the current layout type.
|
addDrawTask, addDrawTask, addScrolledListener, announceAccessibility, arrange, bindCornerMark, callOnClick, canScroll, clearFocus, createAnimatorProperty, disableFadeEffect, draw, enableCornerMark, enableFadeEffect, enableSaveState, enableScrollBar, estimateSize, executeDoubleClick, executeLongClick, 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, invalidate, isBoundaryFadeEffectEnable, isBoundToWindow, isClickable, isClipToContourEnabled, isComponentDisplayed, isEnabled, isFadeEffected, isFocusable, isFocused, isIdentityMatrix, isLongClickOn, isPressed, isRtl, isSaveStateEnabled, isScrollbarFadingOn, isScrollBarOn, isScrollbarOverlapEnabled, isSelected, isSoundEnable, isTouchFocusable, isVibrationEffectEnabled, notifyAccessibility, onAttributeConfigChanged, 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, unsubscribeVoiceEventsaddComponent, addComponent, addComponent, addComponent, addComponent, dispatchRestoreState, dispatchSaveState, findComponentById, findComponentHolderById, getAutoLayout, getChildCount, getChildIndex, getComponentAt, getComponentTransition, getFocusOrder, getLayoutManager, informConfigurationChanged, isClipToChildBoundsEnabled, isClipToPaddingBoundsEnabled, isTouchEventSplitable, moveChildToFront, onDrag, removeAllComponents, removeComponent, removeComponentAt, removeComponentById, setArrangeListener, setAutoLayout, setAutoLayout, setClipToChildBoundsEnabled, setClipToPaddingBoundsEnabled, setComponentTransition, setFocusOrder, setLayoutManager, setTouchEventSplitablegetComponentParent, postLayoutpublic static final SlideDrawer.DisplayMode DEFAULT_DISPLAY_MODE
DisplayMode.public static final float DEFAULT_OPEN_THRESHOLD
public SlideDrawer(Context context)
SlideDrawer instance by using the default attribute set and default
style.context - Indicates the application context.public SlideDrawer(Context context, AttrSet attrSet)
SlideDrawer instance by using the specified attribute set and default
style after the XML file is parsed.context - Indicates the application context.attrSet - Indicates the attribute set to use.public SlideDrawer(Context context, AttrSet attrSet, String styleName)
SlideDrawer instance by using the specified attribute set and specified
style after the XML file is parsed.context - Indicates the application context.attrSet - Indicates the attribute set to use.styleName - Indicates the name of the style to use.public void addSlideListener(SlideDrawer.SlideListener listener)
listener - Indicates the SlideListener object, which can't be null.IllegalArgumentException - Throws this exception if the listener value is null.removeSlideListener(SlideListener),
removeAllSlideListeners(),
hasSlideListeners(),
SlideDrawer.SlideListenerpublic void removeSlideListener(SlideDrawer.SlideListener listener)
You can use removeAllSlideListeners() to remove all listeners.
listener - Indicates the SlideListener object, which can't be null.IllegalArgumentException - Throws this exception if the listener value is null.addSlideListener(SlideListener),
removeAllSlideListeners(),
hasSlideListeners(),
SlideDrawer.SlideListenerpublic void removeAllSlideListeners()
public boolean hasSlideListeners()
SlideDrawer.true if SlideDrawer contains any listener; returns false otherwise.addSlideListener(SlideListener),
removeSlideListener(SlideListener),
removeAllSlideListeners(),
SlideDrawer.SlideListenerpublic void addSlideDisable(SlideDrawer.SlideDisable callback)
callback - Indicates the callback to add. The value can't be null.IllegalArgumentException - Throws this exception if the callback value is null.removeSlideDisable(SlideDisable),
removeAllSlideDisables(),
hasSlideDisables(),
SlideDrawer.SlideDisablepublic void removeSlideDisable(SlideDrawer.SlideDisable callback)
You can use removeAllSlideDisables() to remove all such callbacks.
callback - Indicates the callback to remove. The value can't be null.IllegalArgumentException - Throws this exception if the callback value is null.addSlideDisable(SlideDisable),
removeAllSlideDisables(),
removeSlideDisable(SlideDisable),
hasSlideDisables(),
SlideDrawer.SlideDisablepublic void removeAllSlideDisables()
addSlideDisable(SlideDisable),
removeSlideDisable(SlideDisable),
hasSlideDisables()public boolean hasSlideDisables()
SlideDrawer.true if SlideDrawer contains any disable callback; returns false
otherwise.addSlideDisable(SlideDisable),
removeSlideDisable(SlideDisable),
removeAllSlideDisables()public void setTouchForClose(boolean isEnabled)
SlideDrawer can be closed by a touch.isEnabled - Specifies whether the SlideDrawer can be closed by a touch.isTouchForClose()public boolean isTouchForClose()
SlideDrawer can be closed by a touch.true if the SlideDrawer can be closed by a touch; returns false
otherwise.setTouchForClose(boolean)public void setSlideEnabled(boolean isEnabled)
SlideDrawer can be slid by users.isEnabled - Specifies whether the slide gesture is enabled.isSlideEnabled()public boolean isSlideEnabled()
true if the slide gesture is enabled; returns false otherwise.setSlideEnabled(boolean)public void setOpenThreshold(float percent)
The default percent value is DEFAULT_OPEN_THRESHOLD.
percent - Indicates the percent value.IllegalArgumentException - Throws this exception if the percent value is less than 0.0f or more
than 1.0f.getOpenThreshold()public float getOpenThreshold()
The default percent value is DEFAULT_OPEN_THRESHOLD.
setOpenThreshold(float)public float getSlideDistanceRatio()
public void setMaximumSlideDistance(int max)
max - Indicates the maximum sliding distance.IllegalArgumentException - Throws this exception if the parameter value is less than 0.getSlideDistance(SlideDirection)public int getSlideDistance(SlideDrawer.SlideDirection direction)
direction - Indicates the direction.IllegalArgumentException - Throws this exception if the direction value is null.setMaximumSlideDistance(int)public SlideDrawer.DrawerState getSlideState()
SlideDrawer state. The state value can be DrawerState#OPEN,
DrawerState#MIDDLE, or DrawerState#CLOSE.SlideDrawer.DrawerStatepublic SlideDrawer.SlideDirection getSlideDirection()
SlideDrawer direction. The value can be SlideDirection#START,
SlideDirection#TOP, SlideDirection#END, or SlideDirection#BOTTOM. The returned value
will be null if the current SlideDrawer state isn't DrawerState#OPEN.SlideDirection or null.public void setDisplayMode(SlideDrawer.DisplayMode mode)
DisplayMode#NO_ANIMATION or DisplayMode#WITH_ANIMATION.
The default mode is DEFAULT_DISPLAY_MODE.
You can use the setDisplayMode(ohos.agp.components.SlideDrawer.DisplayMode,ohos.agp.components.SlideDrawer.SlideDirection) method if you wish to set the display
mode only for a specified direction.
You can use the setDisplayMode(ohos.agp.components.SlideDrawer.DisplayMode,ohos.agp.components.SlideDrawer.DisplayMode,ohos.agp.components.SlideDrawer.DisplayMode,ohos.agp.components.SlideDrawer.DisplayMode) method to set
different values for all four directions in one call.
It is not recommended to use DisplayMode#NO_ANIMATION and padding together.
mode - Indicates the display mode.IllegalArgumentException - Throws this exception if the mode value is null.setDisplayMode(DisplayMode, SlideDirection),
setDisplayMode(DisplayMode, DisplayMode, DisplayMode, DisplayMode),
getDisplayMode(SlideDirection),
getDisplayMode(),
SlideDrawer.DisplayModepublic void setDisplayMode(SlideDrawer.DisplayMode mode, SlideDrawer.SlideDirection direction)
DisplayMode#NO_ANIMATION or DisplayMode#WITH_ANIMATION.
The default mode is DEFAULT_DISPLAY_MODE.
You can use the setDisplayMode(ohos.agp.components.SlideDrawer.DisplayMode,ohos.agp.components.SlideDrawer.DisplayMode,ohos.agp.components.SlideDrawer.DisplayMode,ohos.agp.components.SlideDrawer.DisplayMode) method to set
different values for all four directions in one call.
You can use the setDisplayMode(ohos.agp.components.SlideDrawer.DisplayMode) method to set a specified display mode for all
directions.
It is not recommended to use DisplayMode#NO_ANIMATION and padding together.
mode - Indicates the display mode.direction - Indicates the direction.IllegalArgumentException - Throws this exception if the direction or mode value is
null.setDisplayMode(DisplayMode),
setDisplayMode(DisplayMode, DisplayMode, DisplayMode, DisplayMode),
getDisplayMode(SlideDirection),
getDisplayMode(),
SlideDrawer.DisplayMode,
SlideDrawer.SlideDirectionpublic void setDisplayMode(SlideDrawer.DisplayMode startMode, SlideDrawer.DisplayMode topMode, SlideDrawer.DisplayMode endMode, SlideDrawer.DisplayMode bottomMode)
DisplayMode#NO_ANIMATION or DisplayMode#WITH_ANIMATION.
The default mode is DEFAULT_DISPLAY_MODE.
You can use the setDisplayMode(ohos.agp.components.SlideDrawer.DisplayMode,ohos.agp.components.SlideDrawer.SlideDirection) method if you wish to set the display
mode only for a specified direction.
You can use the setDisplayMode(ohos.agp.components.SlideDrawer.DisplayMode) method to set a specified display mode for all
directions.
It is not recommended to use DisplayMode#NO_ANIMATION and padding together.
startMode - Indicates the display mode related to the SlideDirection#START direction.topMode - Indicates the display mode related to the SlideDirection#TOP direction.endMode - Indicates the display mode related to the SlideDirection#END direction.bottomMode - Indicates the display mode related to the SlideDirection#BOTTOM direction.IllegalArgumentException - Throws this exception if any of the modes is null.setDisplayMode(DisplayMode),
setDisplayMode(DisplayMode, SlideDirection),
getDisplayMode(SlideDirection),
getDisplayMode(),
Component.LayoutDirectionpublic SlideDrawer.DisplayMode getDisplayMode(SlideDrawer.SlideDirection direction)
The default mode is DEFAULT_DISPLAY_MODE.
You can use the getDisplayMode() method to obtain the display modes for all the directions in one
call.
direction - Indicates the direction.IllegalArgumentException - Throws this exception if the direction value is null.setDisplayMode(DisplayMode),
setDisplayMode(DisplayMode, SlideDirection),
setDisplayMode(DisplayMode, DisplayMode, DisplayMode, DisplayMode),
getDisplayMode(),
SlideDrawer.SlideDirectionpublic SlideDrawer.DisplayMode[] getDisplayMode()
The default mode is DEFAULT_DISPLAY_MODE.
You can use the getDisplayMode(ohos.agp.components.SlideDrawer.SlideDirection) method to obtain the display mode for a certain
direction.
SlideDirection#START direction;
second element (index 1) - the mode of the SlideDirection#TOP direction;
third element (index 2) - the mode of the SlideDirection#BOTTOM direction;
fourth element (index 3) - the mode of the SlideDirection#END direction.setDisplayMode(DisplayMode, SlideDirection),
setDisplayMode(DisplayMode),
setDisplayMode(DisplayMode, DisplayMode, DisplayMode, DisplayMode),
getDisplayMode(SlideDirection)public boolean open()
SlideDrawer if SlideDrawer contains the optional component only for the
single direction).true if the operation is successful; returns false otherwise.close(),
toggle(),
openSmoothly(),
open(SlideDirection)public boolean open(SlideDrawer.SlideDirection direction)
SlideDrawer in a certain direction if its current state is DrawerState#CLOSE.
You can pass null for direction to open the SlideDrawer if it contains
optional components that can be displayed with a slide only from one direction.direction - Indicates the direction, which can be set to null.true if the operation is successful; returns false otherwise.close(SlideDirection),
toggle(SlideDirection),
openSmoothly(SlideDirection),
open(),
SlideDrawer.SlideDirectionpublic boolean openSmoothly()
SlideDrawer smoothly if SlideDrawer contains the optional component only for the
single direction).true if the operation is successful; returns false otherwise.closeSmoothly(),
toggleSmoothly(),
open(),
openSmoothly(SlideDirection),
openSmoothly(int),
openSmoothly(SlideDirection, int)public boolean openSmoothly(SlideDrawer.SlideDirection direction)
SlideDrawer smoothly in a certain direction if its current state is DrawerState#CLOSE.
You can pass null for direction to open the SlideDrawer if it contains
optional components that can be displayed with a slide only from one direction.direction - Indicates the direction, which can be set to null.true if the operation is successful; returns false otherwise.closeSmoothly(SlideDirection),
toggleSmoothly(SlideDirection),
open(SlideDirection),
openSmoothly(),
openSmoothly(int),
openSmoothly(SlideDirection, int),
SlideDrawer.SlideDirectionpublic boolean openSmoothly(int interval)
SlideDrawer smoothly if SlideDrawer contains the optional component only for the
single direction).interval - Indicates the interval value for scrolling, in milliseconds.true if the operation is successful; returns false otherwise.IllegalArgumentException - Throws this exception if the interval value is less than 0.closeSmoothly(int),
toggleSmoothly(int),
openSmoothly(),
openSmoothly(SlideDirection),
openSmoothly(SlideDirection, int)public boolean openSmoothly(SlideDrawer.SlideDirection direction, int interval)
SlideDrawer smoothly in a certain direction if its current state is DrawerState#CLOSE.
You can pass null for direction to open the SlideDrawer if it contains
optional components that can be displayed with a slide only from one direction.direction - Indicates the direction, which can be set to null.interval - Indicates the interval value for scrolling, in milliseconds.true if the operation is successful; returns false otherwise.IllegalArgumentException - Throws this exception if the interval value is less than 0.closeSmoothly(SlideDirection, int),
toggleSmoothly(SlideDirection, int),
openSmoothly(),
openSmoothly(SlideDirection),
openSmoothly(int),
SlideDrawer.SlideDirectionpublic boolean close()
SlideDrawer if the current state is DrawerState#OPEN.true if the operation is successful; returns false otherwise.open(),
toggle(),
closeSmoothly(),
close(SlideDirection)public boolean close(SlideDrawer.SlideDirection direction)
SlideDrawer in a certain direction if its current state is DrawerState#OPEN
and the direction parameter equals the value returned by getSlideDirection().
You can pass null for direction to close the SlideDrawer anyway.direction - Indicates the direction, which can be set to null.true if the operation is successful; returns false otherwise.open(SlideDirection),
toggle(SlideDirection),
closeSmoothly(SlideDirection),
close(),
SlideDrawer.SlideDirectionpublic boolean closeSmoothly()
SlideDrawer smoothly if its current state is DrawerState#OPEN.true if the operation is successful; returns false otherwise.openSmoothly(),
toggleSmoothly(),
close(),
closeSmoothly(SlideDirection),
closeSmoothly(int),
closeSmoothly(SlideDirection, int)public boolean closeSmoothly(SlideDrawer.SlideDirection direction)
SlideDrawer smoothly in a certain direction if its current state is DrawerState#OPEN
and the direction parameter equals the value returned by getSlideDirection(). You can pass
null for direction to close the SlideDrawer anyway.direction - Indicates the direction, which can be set to null.true if the operation is successful; returns false otherwise.openSmoothly(SlideDirection),
toggleSmoothly(SlideDirection),
close(SlideDirection),
closeSmoothly(int),
closeSmoothly(SlideDirection, int),
SlideDrawer.SlideDirectionpublic boolean closeSmoothly(int interval)
SlideDrawer smoothly if its current state is DrawerState#OPEN.interval - Indicates the interval value for scrolling, in milliseconds.true if the operation is successful; returns false otherwise.IllegalArgumentException - Throws this exception if the interval value is less than 0.openSmoothly(int),
toggleSmoothly(int),
closeSmoothly(),
closeSmoothly(SlideDirection),
closeSmoothly(SlideDirection, int)public boolean closeSmoothly(SlideDrawer.SlideDirection direction, int interval)
SlideDrawer smoothly in a certain direction if its current state is DrawerState#OPEN
and the direction parameter equals the value returned by getSlideDirection(). You can pass
null for direction to close the SlideDrawer anyway.direction - Indicates the direction, which can be set to null.interval - Indicates the interval value for scrolling, in milliseconds.true if the operation is successful; returns false otherwise.IllegalArgumentException - Throws this exception if the interval value is less than 0.openSmoothly(SlideDirection, int),
toggleSmoothly(SlideDirection, int),
closeSmoothly(),
closeSmoothly(SlideDirection),
closeSmoothly(int),
SlideDrawer.SlideDirectionpublic boolean toggle()
true if the operation is successful; returns false otherwise.open(),
close(),
toggleSmoothly(),
toggle(SlideDirection)public boolean toggle(SlideDrawer.SlideDirection direction)
SlideDrawer states between DrawerState#OPEN and DrawerState#CLOSE in a
certain direction.
You can pass null for direction to switch the SlideDrawer states if it contains
optional components that can be displayed with a slide only from one direction.direction - Indicates the direction, which can be set to null.true if the operation is successful; returns false otherwise.open(SlideDirection),
close(SlideDirection),
toggleSmoothly(SlideDirection),
toggle(),
SlideDrawer.SlideDirectionpublic boolean toggleSmoothly()
true if the operation is successful; returns false otherwise.openSmoothly(),
closeSmoothly(),
toggle(),
toggleSmoothly(SlideDirection),
toggleSmoothly(int),
toggleSmoothly(SlideDirection, int)public boolean toggleSmoothly(SlideDrawer.SlideDirection direction)
SlideDrawer states between DrawerState#OPEN and DrawerState#CLOSE smoothly
in a certain direction.
You can pass null for direction to switch the SlideDrawer states if it contains
optional components that can be displayed with a slide only from one direction.direction - Indicates the direction, which can be set to null.true if the operation is successful; returns false otherwise.openSmoothly(SlideDirection),
closeSmoothly(SlideDirection),
toggle(SlideDirection),
toggleSmoothly(),
toggleSmoothly(int),
toggleSmoothly(SlideDirection, int),
SlideDrawer.SlideDirectionpublic boolean toggleSmoothly(int interval)
interval - Indicates the interval value for scrolling, in milliseconds.true if the operation is successful; returns false otherwise.IllegalArgumentException - Throws this exception if the interval value is less than 0.openSmoothly(int),
closeSmoothly(int),
toggleSmoothly(),
toggleSmoothly(SlideDirection),
toggleSmoothly(SlideDirection, int)public boolean toggleSmoothly(SlideDrawer.SlideDirection direction, int interval)
SlideDrawer states between DrawerState#OPEN and DrawerState#CLOSE smoothly
in a certain direction.
You can pass null for direction to switch the SlideDrawer states if it contains
optional components that can be displayed with a slide only from one direction.direction - Indicates the direction, which can be set to null.interval - Indicates the interval value for scrolling, in milliseconds.true if the operation is successful; returns false otherwise.IllegalArgumentException - Throws this exception if the interval value is less than 0.openSmoothly(SlideDirection, int),
closeSmoothly(SlideDirection, int),
toggleSmoothly(),
toggleSmoothly(SlideDirection),
toggleSmoothly(int),
SlideDrawer.SlideDirectionpublic ComponentContainer.LayoutConfig verifyLayoutConfig(ComponentContainer.LayoutConfig config)
verifyLayoutConfig 在接口中 ComponentParentverifyLayoutConfig 在类中 ComponentContainerconfig - Indicates a group of layout parameters to be converted into a ComponentContainer instance.LayoutConfig instance, which represents the layout parameters.public ComponentContainer.LayoutConfig createLayoutConfig(Context context, AttrSet attrSet)
createLayoutConfig 在类中 ComponentContainercontext - Indicates the application context.attrSet - Indicates the attribute set.public void removeComponents(int start,
int count)
removeComponents 在接口中 ComponentParentremoveComponents 在类中 ComponentContainerstart - Indicates the position index of the first removed component.count - Indicates the quantity of components to remove.