ComponentParentNestedScrollView, TabListpublic class ScrollView extends StackLayout
The scroll component is a UI element that allows content to scroll on the screen.
| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
ScrollView.ReboundEffectParams |
Represents rebound effect parameters.
|
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.ArrangeListenerStackLayout.LayoutConfig| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static float |
ROTATION_SENSITIVITY_DEFAULT |
Indicates the default rotation sensitivity of
ScrollView to respond to rotating crown events. |
static float |
ROTATION_SENSITIVITY_HIGH |
Indicates the high rotation sensitivity of
ScrollView to respond to rotating crown events. |
static float |
ROTATION_SENSITIVITY_LOW |
Indicates the low rotation sensitivity of
ScrollView to respond to rotating crown events. |
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| 构造器 | 说明 |
|---|---|
ScrollView(Context context) |
Default constructor used to create a
ScrollView instance by using the default attribute set and style. |
ScrollView(Context context,
AttrSet attrSet) |
A constructor used to create a
ScrollView instance by using specified attribute set and default
style after the XML file is parsed. |
ScrollView(Context context,
AttrSet attrSet,
String styleName) |
A constructor used to create a
ScrollView instance by using specified attribute set and specified style
after the XML file is parsed. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addScrollPausePositionX(int positionX) |
Adds scroll pause position on the X axis.
|
void |
addScrollPausePositionY(int positionY) |
Adds scroll pause position on the Y axis.
|
void |
doFling(int velocityX,
int velocityY) |
Scrolls the component content at a specified velocity.
|
void |
doFlingX(int velocityX) |
Starts flinging along the x axis at a specified initial velocity.
|
void |
doFlingY(int velocityY) |
Starts flinging along the y axis at a specified initial velocity.
|
void |
fluentScrollBy(int deltaX,
int deltaY) |
Scrolls the component content smoothly based on a specified number of pixels.
|
void |
fluentScrollByX(int dx) |
Scrolls the content smoothly by a specified number of pixels along the x axis.
|
void |
fluentScrollByY(int dy) |
Scrolls the content smoothly by a specified number of pixels along the y axis.
|
void |
fluentScrollTo(int x,
int y) |
Scrolls the component content smoothly based on a specified coordinate position.
|
void |
fluentScrollXTo(int x) |
Scrolls the content smoothly to a specified coordinate position along the x axis.
|
void |
fluentScrollYTo(int y) |
Scrolls the content smoothly to a specified coordinate position along the y axis.
|
boolean |
getReboundEffect() |
Checks whether the rebound effect is enabled.
|
ScrollView.ReboundEffectParams |
getReboundEffectParams() |
Obtains the rebound parameters as the
ReboundEffectParams object. |
boolean |
isMatchViewport() |
Checks whether the components of the scroll component can be stretched to fill the viewport.
|
void |
setMatchViewportEnabled(boolean enable) |
Specifies whether the scroll component allows stretch of its components to fill its viewport.
|
void |
setReboundEffect(boolean enabled) |
Sets whether the rebound effect will be enabled.
|
void |
setReboundEffectParams(int overscrollPercent,
float overscrollRate,
int remainVisiblePercent) |
Configure rebound effect parameters.
|
void |
setReboundEffectParams(ScrollView.ReboundEffectParams reboundEffectParams) |
Sets rebound effect parameters.
|
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, removeComponents, setArrangeListener, setAutoLayout, setAutoLayout, setClipToChildBoundsEnabled, setClipToPaddingBoundsEnabled, setComponentTransition, setFocusOrder, setLayoutManager, setTouchEventSplitablegetComponentParent, postLayoutclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateLayoutConfig, verifyLayoutConfigpublic static final float ROTATION_SENSITIVITY_DEFAULT
ScrollView to respond to rotating crown events.
You can use Component.setRotationSensitivity(float) to set.public static final float ROTATION_SENSITIVITY_HIGH
ScrollView to respond to rotating crown events.
You can use Component.setRotationSensitivity(float) to set.public static final float ROTATION_SENSITIVITY_LOW
ScrollView to respond to rotating crown events.
You can use Component.setRotationSensitivity(float) to set.public ScrollView(Context context)
ScrollView instance by using the default attribute set and style.context - Indicates the application context.public ScrollView(Context context, AttrSet attrSet)
ScrollView 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 ScrollView(Context context, AttrSet attrSet, String styleName)
ScrollView 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 doFling(int velocityX,
int velocityY)
velocityX - Indicates the initial velocity for scrolling along the X axis. A positive value
indicates that the component is scrolled leftwards to display the content on the right;
a negative value indicates that the component is scrolled rightwards to display
the content on the left.velocityY - Indicates the initial velocity for scrolling along the Y axis. If the value is a
positive number, the finger is swiping up the screen and the content is scrolled down towards
the bottom.public void doFlingX(int velocityX)
velocityX - Indicates the initial velocity for flinging along the x axis. A positive value indicates
flinging leftwards on the screen to scroll the content rightwards; a negative value indicates
flinging rightwards on the screen to scroll the content leftwards.public void doFlingY(int velocityY)
velocityY - Indicates the initial velocity for flinging along the y axis. A positive value indicates
flinging upwards on the screen to scroll the content downwards; a negative value indicates
flinging downwards on the screen to scroll the content upwards.public void fluentScrollBy(int deltaX,
int deltaY)
deltaX - Indicates the number of pixels for the content component to scroll on the X axis.deltaY - Indicates the number of pixels for the content component to scroll on the Y axis.public void fluentScrollByX(int dx)
dx - Indicates the number of pixels to scroll on the x axis. A positive value indicates scrolling
rightwards, and a negative value indicates scrolling leftwards.public void fluentScrollByY(int dy)
dy - Indicates the number of pixels to scroll on the y axis. A positive value indicates scrolling downwards,
and a negative value indicates scrolling upwards.public void fluentScrollTo(int x,
int y)
x - Indicates the target position to scroll the component content on the X axis.y - Indicates the target position to scroll the component content on the Y axis.public void fluentScrollXTo(int x)
x - Indicates the target position to scroll the content on the x axis.public void fluentScrollYTo(int y)
y - Indicates the target position to scroll the content on the y axis.public void setMatchViewportEnabled(boolean enable)
enable - Indicates whether to allow the stretch of components of the scroll component.
Set this parameter to true if you need the components to fill
the viewport of the scroll component; set it to false otherwise.public boolean isMatchViewport()
When you want the components to fill the viewport of the scroll component, set
the fillViewport parameter in the setMatchViewportEnabled(boolean) method to true;
set it to false otherwise.
true if the components can be stretched to fill the viewport;
returns false otherwise.public void setReboundEffect(boolean enabled)
enabled - Specifies whether to enable the rebound effect. Value true indicates to enable the
rebound effect, and false indicates to disable the rebound effect.public boolean getReboundEffect()
true if the rebound effect is enabled; returns false otherwise.public void setReboundEffectParams(int overscrollPercent,
float overscrollRate,
int remainVisiblePercent)
overscrollPercent - Indicates the overscroll percent (default value: 40). If the percent of
scrolled content exceeds the value of this parameter, the content scrolling speed is affected by the
overscrollRate parameter. Specifically, if the value of overscrollRate is less than
1.0, your finger moves faster than the content.overscrollRate - Indicates the overscroll rate (default value: 0.6). This parameter affects the
content scrolling speed if the percent of scrolled content exceeds the value of the
overscrollPercent parameter. Specifically, the content scrolling speed is equal to the finger
scrolling speed multiplied by the value of overscrollRate.remainVisiblePercent - Indicates the minimum percent of scrollable content that should remain visible
during overscrolling. The default value is 20.IllegalArgumentException - if at least one of the following conditions is true:
(1) overscrollPercent is not in range [0, 100] (2) overscrollRate <= 0
(3) remainVisiblePercent is not in range [0, 100]public void setReboundEffectParams(ScrollView.ReboundEffectParams reboundEffectParams)
reboundEffectParams - Indicates a ReboundEffectParams object holding the rebound effect parameters.IllegalArgumentException - if reboundEffectParams is null or contains invalid value.getReboundEffectParams(),
setReboundEffectParams(int, float, int)public ScrollView.ReboundEffectParams getReboundEffectParams()
ReboundEffectParams object.ReboundEffectParams object holding the rebound parameters.setReboundEffectParams(ReboundEffectParams),
setReboundEffectParams(int, float, int)public void addScrollPausePositionX(int positionX)
positionX - Indicates the pause position scroll on the X axis.public void addScrollPausePositionY(int positionY)
positionY - Indicates the pause position scroll on the Y axis.