鴻蒙OS ListComponent

2022-09-23 14:58 更新

ListComponent

java.lang.Object

|---ohos.agp.components.Component

|---|---ohos.agp.components.ComponentContainer

|---|---|---ohos.agp.components.ListComponent

public class ListComponent
extends ComponentContainer

一個容器類,用于顯示可以在屏幕上上下滾動的列表。

嵌套類摘要

修飾符和類型 描述
static interface ListComponent.BounceBackListener 實現(xiàn)監(jiān)聽反彈狀態(tài)的變化,包括反彈開始、反彈進行中、反彈結(jié)束。
static interface ListComponent.CachePolicyListener 實現(xiàn)監(jiān)聽以將組件添加到 ListComponentPool。
static class ListComponent.ListLayoutConfig 繼承自 ComponentContainer.LayoutConfig 并提供方法使 ListComponent 中的組件能夠訪問對應(yīng)的 ComponentOwner。
static interface ListComponent.OnComponentBoundStatusChangeListener 實現(xiàn)監(jiān)聽 ListComponent 的狀態(tài)變化。
static class ListComponent.OnFlingListener 實現(xiàn)監(jiān)聽。
static class ListComponent.ReboundEffectParams 提供參數(shù)來實現(xiàn)反彈效果。
從類 ohos.agp.components.Component 繼承的嵌套類/接口
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.VoiceEvent
從類 ohos.agp.components.ComponentContainer 繼承的嵌套類/接口
ComponentContainer.ArrangeListener, ComponentContainer.LayoutConfig

字段摘要

修飾符和類型 字段 描述
static int HORIZONTAL 表示組件在 ListComponent 中水平排列。
static long INVALID_ID 表示 ListComponent 中的組件 ID 無效。
static int INVALID_POSITION 指示 ListComponent 中的無效組件位置。
static int INVALID_TYPE 表示 ListComponent 中的組件類型無效。
static int ITEM_TYPE_NO_SCALE_MASK 表示不使用比例。
static int ITEM_TYPE_NO_STICK_MASK 表示不使用搖桿。
static int LIST_SCROLL_STATE_DRAGGING 指示正在拖動 ListComponent。
static int LIST_SCROLL_STATE_IDLE 表示 ListComponent 處于空閑狀態(tài)。
static int LIST_SCROLL_STATE_SETTLING 表示 ListComponent 正在被滑動。
static int UNDEFINED_DURATION 表示未定義滾動持續(xù)時間。
static int VERTICAL 表示組件在 ListComponent 中垂直排列。
從類 ohos.agp.components.Component 繼承的字段
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, 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, VISIBLE
從類 ohos.agp.components.ComponentContainer 繼承的字段
FOCUS_CHILDREN_FIRST, FOCUS_CHILDREN_HIDE, FOCUS_PARENT_FIRST, mArrangeListener

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
ListComponent(Context context) 用于根據(jù)默認屬性集和樣式創(chuàng)建 ListComponent 實例的構(gòu)造函數(shù)。
ListComponent(Context context, AttrSet attrSet) 用于根據(jù)指定的屬性集和默認樣式創(chuàng)建 ListComponent 實例的構(gòu)造函數(shù)。
ListComponent(Context context, AttrSet attrSet, String styleName) 用于根據(jù)指定的屬性集和樣式創(chuàng)建 ListComponent 實例的構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型 方法 描述
void addBounceBackListener(ListComponent.BounceBackListener listener) 為反彈狀態(tài)更改添加偵聽器。
void addCachePolicyListener(ListComponent.CachePolicyListener listener) 為緩存策略添加偵聽器。
void addComponent(Component childComponent) 通過在內(nèi)部調(diào)用 ComponentContainer.addComponent(ohos.agp.components.Component,int index) 將組件添加到隊列的末尾。
void addComponent(Component childComponent, int index) 將組件添加到指定位置。
void addComponent(Component childComponent, int width, int height) 添加一個組件并設(shè)置其寬度和高度。
void addComponent(Component childComponent, int index, ComponentContainer.LayoutConfig layoutConfig) 添加組件并設(shè)置其布局參數(shù)和位置。
void addComponent(Component childComponent, ComponentContainer.LayoutConfig layoutConfig) 添加一個組件并設(shè)置其布局參數(shù)。
void addListAdornment(ListAdornment adorn) 在此 ListComponent 的末尾添加一個 ListAdornment 對象。
void addListAdornment(ListAdornment adorn, int index) 將 ListAdornment 對象添加到此 ListComponent 的指定位置。
void addOnComponentBoundStatusChangeListener(ListComponent.OnComponentBoundStatusChangeListener listener) 添加一個偵聽器,當(dāng)子組件綁定到此 ListComponent 或從此 ListComponent 解除綁定時將通知該偵聽器。
void alignChildComponentXCoordinate(int dx) 設(shè)置此 ListComponent 中所有子組件邊界的水平像素偏移。
void alignChildComponentYCoordinate(int dy) 設(shè)置此 ListComponent 中所有子組件邊界的垂直像素偏移。
void clearBounceBackListeners() 刪除反彈狀態(tài)更改的所有偵聽器。
void clearOnComponentBoundStatusChangeListener() 當(dāng)子組件綁定到此列表組件或從該列表組件解除綁定時,移除所有收到通知的偵聽器。
protected void createNativePtr()
boolean fling(int speedX, int speedY) 以水平和垂直方向的初始速度觸發(fā)此 ListComponent 的投擲。
void getAdornedBoundryIncludeMargin(Component component, Rect outBounds) 獲取子組件的邊界,包括其裝飾和邊距。
long getChildComponentId(Component child) 獲取此 ListComponent 中子組件的 ID。
ComponentOwner getChildComponentOwner(Component child) 獲取子組件的 ComponentOwner。
int getChildCount() 獲取子組件的數(shù)量。
int getChildLayoutPosition(Component component) 獲取最近一次布局計算后子組件在提供者中的位置。
int getChildProviderPosition(Component component) 獲取提供者中子組件的位置。
Component getComponentAt(int position) 使用索引獲取子組件。
ComponentOwner getComponentOwnerById(long id) 根據(jù)子組件ID獲取ComponentOwner。
ItemAnimation getItemAnimation() 獲取 ItemAnimation 對象,該對象用于處理提供者更改時發(fā)生的動畫。
ListAdornment getListAdornmentAt(int index) 獲取具有此 ListComponent 的給定索引的 ListAdornment 對象。
int getListAdornmentCount() 獲取此 ListComponent 中的 ListAdornment 對象的數(shù)量。
ListComponentPool getListCachedPool() 獲取此 ListComponent 的回收池。
ListLayoutManager getListLayoutManager() 獲取此 ListComponent 使用的 ListLayoutManager 對象。
int getMaxFlingSpeed() 獲得觸發(fā)投擲的最大速度。
int getMinFlingSpeed() 獲得觸發(fā)投擲的最小速度。
Provider getProvider() 獲取此 ListComponent 的提供者。
boolean getReboundEffect() 檢查反彈效果是否開啟。
ListComponent.ReboundEffectParams getReboundEffectParams() 以 ReboundEffectParams 對象的形式獲取回彈效果參數(shù)。
boolean getRecoverfocusAfterRefresh() 檢查此 ListComponent 在布局計算后是否保持同一個子組件的焦點。
boolean hasIncomingProviderRefresh() 檢查是否存在尚未應(yīng)用于布局的提供程序更新。
boolean isCalculatingLayout() 檢查此 ListComponent 是否正在計算布局。
boolean isListAnimating() 檢查此 ListComponent 是否正在運行動畫。
boolean isPostponeLayout() 檢查此 ListComponent 的布局請求是否被推遲。
boolean isScrollingSmoothly() 檢查此 ListComponent 是否正在平滑滾動。
boolean isSizeFixed() 檢查此 ListComponent 的提供者是否具有固定大小。
void onBounceBackChange(int xOverScrolled, int yOverScrolled) 在反彈過程中調(diào)用。
void onBounceBackEnd(int xOverScrolled, int yOverScrolled) 反彈結(jié)束時調(diào)用。
void onBounceBackStart(int xOverScrolled, int yOverScrolled) 反彈開始時調(diào)用。
void onComponentBoundToWindow(Component child) 當(dāng)子組件綁定到此 ListComponent 時調(diào)用。
void onComponentUnboundFromWindow(Component child) 當(dāng)子組件與此 ListComponent 解除綁定時調(diào)用。
void postLayout() 請求重新排列組件的布局。
void postponeLayout(boolean isPostponeLayout) 設(shè)置是否推遲此 ListComponent 的布局請求。
void refreshListAdornments() 主動刷新此 ListComponent 中的 ListAdornment 對象。
void removeAllComponents() 清除 ComponentContainer 管理的所有組件。
void removeBounceBackListener(ListComponent.BounceBackListener listener) 刪除反彈狀態(tài)更改的偵聽器。
void removeCachePolicyListener(ListComponent.CachePolicyListener listener) 刪除緩存策略的偵聽器。
void removeComponent(Component component) 從父組件中移除子組件。
void removeComponentAt(int index) 從組件列表中的指定位置移除組件。
void removeComponentById(int id) 根據(jù) ID 移除組件。
void removeComponents(int start, int count) 從組件列表中的指定位置移除所有組件。
void removeListAdornment(ListAdornment decor) 從此 ListComponent 中移除給定的 ListAdornment 對象。
void removeListAdornmentAt(int index) 移除具有此 ListComponent 的給定索引的 ListAdornment 對象。
void removeOnComponentBoundStatusChangeListener(ListComponent.OnComponentBoundStatusChangeListener listener) 移除在子組件綁定到此 ListComponent 或從此 ListComponent 解除綁定時收到通知的偵聽器。
void scrollBy(int x, int y) 將此 ListComponent 滾動一個相對距離。
void scrollByInSmoothMode(int dx, int dy) 將此 ListComponent 平滑滾動一個相對距離。
void scrollByInSmoothMode(int dx, int dy, Animator.TimelineCurve curve) 根據(jù)滾動曲線以相對距離平滑滾動此 ListComponent。
void scrollTo(int x, int y) 將此 ListComponent 滾動到指定的水平和垂直坐標(biāo)。
void scrollToPosition(int position) 將此 ListComponent 滾動到特定位置。
void scrollToPositionInSmoothMode(int position) 將此 ListComponent 平滑滾動到特定位置。
Component searchChildComponentBelowPoint(float x, float y) 根據(jù)屏幕上的坐標(biāo)搜索子組件。
ComponentOwner searchComponentOwnerForLayoutPosition(int position) 根據(jù)指定位置在最新布局中搜索 ComponentOwner。
ComponentOwner searchComponentOwnerForProviderPosition(int position) 根據(jù)指定位置在提供者中搜索 ComponentOwner。
Component searchParentComponentOfChild(Component component) 搜索包含指定組件的子組件(grandchild 組件)。
ComponentOwner searchParentComponentOwnerOfChild(Component component) 搜索包含指定組件(grandchild 組件)的子組件的 ComponentOwner。
void setIsFixedSize(boolean isFixedSize) 設(shè)置此 ListComponent 的提供者是否具有固定大小。
void setItemAnimation(ItemAnimation animation) 設(shè)置一個 ItemAnimation 對象,用于處理提供者更改時發(fā)生的動畫。
void setLayoutManager(LayoutManager layoutManager) 設(shè)置一個 LayoutManager 實例,用于布局相關(guān)子組件。
void setListCachedPool(ListComponentPool pool) 為此 ListComponent 設(shè)置回收池。
void setListLayoutManager(ListLayoutManager layoutManager) 為此 ListComponent 設(shè)置一個 ListLayoutManager 對象。
void setOnFlingListener(ListComponent.OnFlingListener listener) 為此 ListComponent 設(shè)置一個 OnFlingListener。
void setProvider(Provider provider) 設(shè)置此 ListComponent 的提供程序。
void setReboundEffect(boolean enabled) 設(shè)置是否開啟反彈效果。
void setReboundEffectParams(int overscrollPercent, float overscrollRate, int remainVisiblePercent) 設(shè)置回彈效果參數(shù)。
void setReboundEffectParams(ListComponent.ReboundEffectParams reboundEffectParams) 使用 ReboundEffectParams 對象設(shè)置回彈效果參數(shù)。
void setRecoverfocusAfterRefresh(boolean recoverFocusAfterRefresh) 設(shè)置此 ListComponent 在布局計算后是否保持同一個子組件的焦點。
void setRequestedCacheMax(int count) 設(shè)置可以緩存的屏幕外組件的最大數(shù)量。
void stopScroll() 停止當(dāng)前滾動。
void switchProvider(Provider provider, boolean deleteAndReuseComponents) 將此 ListComponent 的提供者替換為新的提供者。
ComponentContainer.LayoutConfig verifyLayoutConfig(ComponentContainer.LayoutConfig config) 自定義一個 LayoutConfig 對象,使 ComponentOwner 擁有 ListLayoutManager 的元數(shù)據(jù)。
從類 ohos.agp.components.Component 繼承的方法
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, refreshContour, release, removeBindStateChangedListener, removeScrolledListener, requestFocus, requestForceForwardTouchEvent, restoreComponentTreeState, saveComponentTreeState, 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, unsubscribeVoiceEvents
從類 ohos.agp.components.ComponentContainer 繼承的方法
createLayoutConfig, dispatchRestoreState, dispatchSaveState, findComponentById, findComponentHolderById, getAutoLayout, getChildIndex, getComponentTransition, getFocusOrder, getLayoutManager, informConfigurationChanged, isClipToChildBoundsEnabled, isClipToPaddingBoundsEnabled, isTouchEventSplitable, moveChildToFront, onDrag, setArrangeListener, setAutoLayout, setAutoLayout, setClipToChildBoundsEnabled, setClipToPaddingBoundsEnabled, setComponentTransition, setFocusOrder, setTouchEventSplitable
從接口 ohos.agp.components.ComponentParent 繼承的方法
getComponentParent
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

字段詳細信息

HORIZONTAL

public static final int HORIZONTAL

表示組件在 ListComponent 中水平排列。

INVALID_ID

public static final long INVALID_ID

表示 ListComponent 中的組件 ID 無效。

INVALID_POSITION

public static final int INVALID_POSITION

指示 ListComponent 中的無效組件位置。

INVALID_TYPE

public static final int INVALID_TYPE

表示 ListComponent 中的組件類型無效。

ITEM_TYPE_NO_SCALE_MASK

public static final int ITEM_TYPE_NO_SCALE_MASK

表示不使用比例。

ITEM_TYPE_NO_STICK_MASK

public static final int ITEM_TYPE_NO_STICK_MASK

表示不使用搖桿。

LIST_SCROLL_STATE_DRAGGING

public static final int LIST_SCROLL_STATE_DRAGGING

指示正在拖動 ListComponent。

LIST_SCROLL_STATE_IDLE

public static final int LIST_SCROLL_STATE_IDLE

表示 ListComponent 處于空閑狀態(tài)。

LIST_SCROLL_STATE_SETTLING

public static final int LIST_SCROLL_STATE_SETTLING

表示 ListComponent 正在被滑動。

UNDEFINED_DURATION

public static final int UNDEFINED_DURATION

表示未定義滾動持續(xù)時間。

VERTICAL

public static final int VERTICAL

表示組件在 ListComponent 中垂直排列。

構(gòu)造函數(shù)詳細信息

ListComponent

public ListComponent(Context context)

用于根據(jù)默認屬性集和樣式創(chuàng)建 ListComponent 實例的構(gòu)造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
context 指示應(yīng)用程序上下文。

ListComponent

public ListComponent(Context context, AttrSet attrSet)

用于根據(jù)指定的屬性集和默認樣式創(chuàng)建 ListComponent 實例的構(gòu)造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
context 指示應(yīng)用程序上下文。
attrSet 指示要使用的屬性集。

ListComponent

public ListComponent(Context context, AttrSet attrSet, String styleName)

用于根據(jù)指定的屬性集和樣式創(chuàng)建 ListComponent 實例的構(gòu)造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
context 指示應(yīng)用程序上下文。
attrSet 指示要使用的屬性集。
styleName 指示要使用的樣式的名稱。

方法詳情

createNativePtr

protected void createNativePtr()

addComponent

public void addComponent(Component childComponent)

通過在內(nèi)部調(diào)用 ComponentContainer.addComponent(ohos.agp.components.Component,int index) 將組件添加到隊列的末尾。

覆蓋:

類 ComponentContainer 中的 addComponent

參數(shù):

參數(shù)名稱 參數(shù)描述
childComponent 指示要添加的子組件。

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

addComponent

public void addComponent(Component childComponent, int width, int height)

添加一個組件并設(shè)置其寬度和高度。

覆蓋:

類 ComponentContainer 中的 addComponent

參數(shù):

參數(shù)名稱 參數(shù)描述
childComponent 指示要添加的子組件。
width 指示子組件的寬度,以像素為單位。
height 指示子組件的高度,以像素為單位。

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

addComponent

public void addComponent(Component childComponent, ComponentContainer.LayoutConfig layoutConfig)

添加一個組件并設(shè)置其布局參數(shù)。

覆蓋:

類 ComponentContainer 中的 addComponent

參數(shù):

參數(shù)名稱 參數(shù)描述
childComponent 指示要添加的子組件。
layoutConfig 表示子組件的布局參數(shù)。

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

addComponent

public void addComponent(Component childComponent, int index, ComponentContainer.LayoutConfig layoutConfig)

添加組件并設(shè)置其布局參數(shù)和位置。

覆蓋:

類 ComponentContainer 中的 addComponent

參數(shù):

參數(shù)名稱 參數(shù)描述
childComponent 指示要添加的子組件。
index 指示添加子組件的位置。 值 -1 表示將子組件添加到隊列的末尾。
layoutConfig 表示子組件的布局參數(shù)。

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

addComponent

public void addComponent(Component childComponent, int index)

將組件添加到指定位置。

如果沒有為該子組件設(shè)置布局參數(shù),則使用 ComponentContainer 的默認布局參數(shù)。

覆蓋:

類 ComponentContainer 中的 addComponent

參數(shù):

參數(shù)名稱 參數(shù)描述
childComponent 指示要添加的子組件。
index 指示添加子組件的位置。 值 -1 表示將組件添加到末尾。 如果提供的數(shù)字大于 getChildCount() 的值,則返回運行時異常。

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

removeComponent

public void removeComponent(Component component)

從父組件中移除子組件。

指定者:

接口 ComponentParent 中的 removeComponent

覆蓋:

ComponentContainer 類中的 removeComponent

參數(shù):

參數(shù)名稱 參數(shù)描述
component 指示要移除的子組件。

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

removeComponentAt

public void removeComponentAt(int index)

從組件列表中的指定位置移除組件。

指定者:

接口 ComponentParent 中的 removeComponentAt

覆蓋:

ComponentContainer 類中的 removeComponentAt

參數(shù):

參數(shù)名稱 參數(shù)描述
index 指示要移除的組件的位置索引。

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

removeComponentById

public void removeComponentById(int id)

根據(jù) ID 移除組件。

覆蓋:

ComponentContainer 類中的 removeComponentById

參數(shù):

參數(shù)名稱 參數(shù)描述
id 表示組件ID。

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

removeComponents

public void removeComponents(int start, int count)

從組件列表中的指定位置移除所有組件。

指定者:

接口 ComponentParent 中的 removeComponents

覆蓋:

ComponentContainer 類中的 removeComponents

參數(shù):

參數(shù)名稱 參數(shù)描述
start 表示第一個移除的組件的位置索引。
count 表示要移除的組件數(shù)量。

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

removeAllComponents

public void removeAllComponents()

清除 ComponentContainer 管理的所有組件。

覆蓋:

ComponentContainer 類中的 removeAllComponents

Throws:

Throw名稱 Throw描述
UnsupportedOperationException ListContainer 中不允許使用方法。

getComponentAt

public Component getComponentAt(int position)

從類復(fù)制的描述:ComponentContainer

使用索引獲取子組件。

ComponentContainer 使用內(nèi)部列表來存儲子組件信息。 您可以使用索引獲取指定的子組件。

覆蓋:

類 ComponentContainer 中的 getComponentAt

參數(shù):

參數(shù)名稱 參數(shù)描述
position 表示子組件的索引。

返回:

返回子組件。

getChildCount

public int getChildCount()

從類復(fù)制的描述:ComponentContainer

獲取子組件的數(shù)量。

覆蓋:

ComponentContainer 類中的 getChildCount

返回:

返回子組件的數(shù)量。

onComponentBoundToWindow

public void onComponentBoundToWindow(Component child)

當(dāng)子組件綁定到此 ListComponent 時調(diào)用。

參數(shù):

參數(shù)名稱 參數(shù)描述
child 表示綁定到 ListComponent 的子組件。

onComponentUnboundFromWindow

public void onComponentUnboundFromWindow(Component child)

當(dāng)子組件與此 ListComponent 解除綁定時調(diào)用。

參數(shù):

參數(shù)名稱 參數(shù)描述
child 表示未綁定 ListComponent 的子組件。

setListLayoutManager

public void setListLayoutManager(ListLayoutManager layoutManager)

為此 ListComponent 設(shè)置一個 ListLayoutManager 對象。

參數(shù):

參數(shù)名稱 參數(shù)描述
layoutManager 指示要設(shè)置的 ListLayoutManager 對象。

getListLayoutManager

public ListLayoutManager getListLayoutManager()

獲取此 ListComponent 使用的 ListLayoutManager 對象。

返回:

返回 ListLayoutManager 對象。

setProvider

public void setProvider(Provider provider)

設(shè)置此 ListComponent 的提供程序。

參數(shù):

參數(shù)名稱 參數(shù)描述
provider 指示要設(shè)置的提供程序。

getProvider

public Provider getProvider()

獲取此 ListComponent 的提供者。

返回:

如果獲得,則返回提供者; 如果未設(shè)置提供程序,則返回 null。

setIsFixedSize

public void setIsFixedSize(boolean isFixedSize)

設(shè)置此 ListComponent 的提供者是否具有固定大小。

此方法可用于在提供程序更改時提高布局性能。

參數(shù):

參數(shù)名稱 參數(shù)描述
isFixedSize 指定提供程序是否具有固定大小。 值 true 表示提供者有固定大小,表示提供者改變不影響 ListComponent 的大?。?nbsp;值 false 表示相反。

isSizeFixed

public boolean isSizeFixed()

檢查此 ListComponent 的提供者是否具有固定大小。

返回:

如果提供者具有固定大小,則返回 true; 否則返回 false。

isCalculatingLayout

public boolean isCalculatingLayout()

檢查此 ListComponent 是否正在計算布局。

返回:

如果 ListComponent 正在計算布局,則返回 true; 否則返回 false。

alignChildComponentYCoordinate

public void alignChildComponentYCoordinate(int dy)

設(shè)置此 ListComponent 中所有子組件邊界的垂直像素偏移。

參數(shù):

參數(shù)名稱 參數(shù)描述
dy 指示要設(shè)置的垂直像素偏移量。

alignChildComponentXCoordinate

public void alignChildComponentXCoordinate(int dx)

設(shè)置此 ListComponent 中所有子組件邊界的水平像素偏移。

參數(shù):

參數(shù)名稱 參數(shù)描述
dx 指示要設(shè)置的水平像素偏移量。

switchProvider

public void switchProvider(Provider provider, boolean deleteAndReuseComponents)

將此 ListComponent 的提供者替換為新的提供者。

在替換provider之前,可以通過deleteAndReuseComponents參數(shù)判斷是否回收ListComponent中的所有子組件。

參數(shù):

參數(shù)名稱 參數(shù)描述
provider 表示新的提供者。 值 null 表示不會設(shè)置提供程序。
deleteAndReuseComponents 指定是否回收 ListComponent 中的所有子組件。 true 表示回收所有子組件,false 表示相反。

addOnComponentBoundStatusChangeListener

public void addOnComponentBoundStatusChangeListener(ListComponent.OnComponentBoundStatusChangeListener listener)

添加一個偵聽器,當(dāng)子組件綁定到此 ListComponent 或從此 ListComponent 解除綁定時將通知該偵聽器。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 指示要添加的偵聽器。

clearOnComponentBoundStatusChangeListener

public void clearOnComponentBoundStatusChangeListener()

當(dāng)子組件綁定到此列表組件或從該列表組件解除綁定時,移除所有收到通知的偵聽器。

removeOnComponentBoundStatusChangeListener

public void removeOnComponentBoundStatusChangeListener(ListComponent.OnComponentBoundStatusChangeListener listener)

移除在子組件綁定到此 ListComponent 或從此 ListComponent 解除綁定時收到通知的偵聽器。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 指示要刪除的偵聽器。

getChildProviderPosition

public int getChildProviderPosition(Component component)

獲取提供者中子組件的位置。

參數(shù):

參數(shù)名稱 參數(shù)描述
component 表示子組件。

返回:

如果獲得,則返回子組件的位置; 如果組件為空,則返回 -1。

getChildLayoutPosition

public int getChildLayoutPosition(Component component)

獲取最近一次布局計算后子組件在提供者中的位置。

參數(shù):

參數(shù)名稱 參數(shù)描述
component 表示子組件。

返回:

如果獲得,則返回子組件的位置; 如果組件為空,則返回 -1。

getChildComponentId

public long getChildComponentId(Component child)

獲取此 ListComponent 中子組件的 ID。

參數(shù):

參數(shù)名稱 參數(shù)描述
child 表示子組件。

返回:

如果獲取,則返回子組件 ID; 如果 child 為 null,則返回 -1。

searchComponentOwnerForLayoutPosition

public ComponentOwner searchComponentOwnerForLayoutPosition(int position)

根據(jù)指定位置在最新布局中搜索 ComponentOwner。

參數(shù):

參數(shù)名稱 參數(shù)描述
position 指示組件在提供程序中的位置。

返回:

如果獲得,則返回 ComponentOwner; 否則返回 null。

searchComponentOwnerForProviderPosition

public ComponentOwner searchComponentOwnerForProviderPosition(int position)

根據(jù)指定位置在提供者中搜索 ComponentOwner。

參數(shù):

參數(shù)名稱 參數(shù)描述
position 指示組件在提供程序中的位置。

返回:

如果獲得,則返回 ComponentOwner; 否則返回 null。

getComponentOwnerById

public ComponentOwner getComponentOwnerById(long id)

根據(jù)子組件ID獲取ComponentOwner。

參數(shù):

參數(shù)名稱 參數(shù)描述
id 表示子組件ID。

返回:

如果獲得,則返回 ComponentOwner; 否則返回 null。

searchChildComponentBelowPoint

public Component searchChildComponentBelowPoint(float x, float y)

根據(jù)屏幕上的坐標(biāo)搜索子組件。

參數(shù):

參數(shù)名稱 參數(shù)描述
x 表示水平坐標(biāo),以像素為單位。
y 表示垂直坐標(biāo),以像素為單位。

返回:

如果獲得則返回子組件; 否則返回 null。

getChildComponentOwner

public ComponentOwner getChildComponentOwner(Component child)

獲取子組件的 ComponentOwner。

參數(shù):

參數(shù)名稱 參數(shù)描述
child 指示要查詢的子組件。

返回:

如果獲得,則返回 ComponentOwner; 如果 child 為 null、未獲取 ComponentOwner 或發(fā)生異常,則返回 null。

searchParentComponentOfChild

public Component searchParentComponentOfChild(Component component)

搜索包含指定組件的子組件(grandchild 組件)。

參數(shù):

參數(shù)名稱 參數(shù)描述
component 指示 grandchild 組件。

返回:

如果獲得則返回子組件; 否則返回 null。

searchParentComponentOwnerOfChild

public ComponentOwner searchParentComponentOwnerOfChild(Component component)

搜索包含指定組件(grandchild 組件)的子組件的 ComponentOwner。

參數(shù):

參數(shù)名稱 參數(shù)描述
component 指示 grandchild 組件。

返回:

如果獲得,則返回 ComponentOwner; 否則返回 null。

hasIncomingProviderRefresh

public boolean hasIncomingProviderRefresh()

檢查是否存在尚未應(yīng)用于布局的提供程序更新。

返回:

如果存在未應(yīng)用于布局的提供程序更新,則返回 true; 如果布局是最新的或發(fā)生異常,則返回 false。

addCachePolicyListener

public void addCachePolicyListener(ListComponent.CachePolicyListener listener)

為緩存策略添加偵聽器。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 指示要添加的偵聽器。

removeCachePolicyListener

public void removeCachePolicyListener(ListComponent.CachePolicyListener listener)

刪除緩存策略的偵聽器。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 指示要刪除的偵聽器。

getListCachedPool

public ListComponentPool getListCachedPool()

獲取此 ListComponent 的回收池。

如果沒有為此 ListComponent 設(shè)置回收池,則此方法創(chuàng)建一個并返回它。

返回:

返回回收池。

setListCachedPool

public void setListCachedPool(ListComponentPool pool)

為此 ListComponent 設(shè)置回收池。

參數(shù):

參數(shù)名稱 參數(shù)描述
pool 指示要設(shè)置的回收池。 如果此參數(shù)為空,則創(chuàng)建并使用一個新池。

setRequestedCacheMax

public void setRequestedCacheMax(int count)

設(shè)置可以緩存的屏幕外組件的最大數(shù)量。

參數(shù):

參數(shù)名稱 參數(shù)描述
count 指示要設(shè)置的離屏組件的數(shù)量。

scrollToPositionInSmoothMode

public void scrollToPositionInSmoothMode(int position)

將此 ListComponent 平滑滾動到特定位置。

參數(shù):

參數(shù)名稱 參數(shù)描述
position 指示要滾動到的位置。

fling

public boolean fling(int speedX, int speedY)

以水平和垂直方向的初始速度觸發(fā)此 ListComponent 的投擲。

參數(shù):

參數(shù)名稱 參數(shù)描述
speedX 表示水平方向的初始速度,以像素/秒為單位。
speedY 表示垂直方向的初始速度,以像素/秒為單位。

返回:

如果投擲開始,則返回 true; 如果由于初始速度低而無法啟動投擲,如果 LayoutManager 不支持投擲,或者發(fā)生異常,則返回 false。

getMinFlingSpeed

public int getMinFlingSpeed()

獲得觸發(fā)投擲的最小速度。

返回:

返回最小速度。

getMaxFlingSpeed

public int getMaxFlingSpeed()

獲得觸發(fā)投擲的最大速度。

返回:

返回最大速度。

scrollToPosition

public void scrollToPosition(int position)

將此 ListComponent 滾動到特定位置。

參數(shù):

參數(shù)名稱 參數(shù)描述
position 指示要滾動到的位置。

scrollTo

public void scrollTo(int x, int y)

將此 ListComponent 滾動到指定的水平和垂直坐標(biāo)。

覆蓋:

類 Component 中的 scrollTo

參數(shù):

參數(shù)名稱 參數(shù)描述
x 指示要滾動到的水平坐標(biāo)。
y 指示要滾動到的垂直坐標(biāo)。

scrollBy

public void scrollBy(int x, int y)

將此 ListComponent 滾動一個相對距離。

覆蓋:

類 Component 中的 scrollBy

參數(shù):

參數(shù)名稱 參數(shù)描述
x 指示要滾動的水平距離。
y 指示要滾動的垂直距離。

stopScroll

public void stopScroll()

停止當(dāng)前滾動。

scrollByInSmoothMode

public void scrollByInSmoothMode(int dx, int dy)

將此 ListComponent 平滑滾動一個相對距離。

參數(shù):

參數(shù)名稱 參數(shù)描述
dx 指示要滾動的水平距離,以像素為單位。
dy 指示要滾動的垂直距離,以像素為單位。

scrollByInSmoothMode

public void scrollByInSmoothMode(int dx, int dy, Animator.TimelineCurve curve)

根據(jù)滾動曲線以相對距離平滑滾動此 ListComponent。

參數(shù):

參數(shù)名稱 參數(shù)描述
dx 指示要滾動的水平距離,以像素為單位。
dy 指示要滾動的垂直距離,以像素為單位。
curve 表示滾動曲線。

setItemAnimation

public void setItemAnimation(ItemAnimation animation)

設(shè)置一個 ItemAnimation 對象,用于處理提供者更改時發(fā)生的動畫。

如果不調(diào)用此方法,將使用 DefaultItemAnimation。

參數(shù):

參數(shù)名稱 參數(shù)描述
animation 指示要設(shè)置的 ItemAnimation 對象。 如果此參數(shù)為 null,則當(dāng) ListComponent 中的子組件發(fā)生更改時,不會發(fā)生動畫。

getItemAnimation

public ItemAnimation getItemAnimation()

獲取 ItemAnimation 對象,該對象用于處理提供者更改時發(fā)生的動畫。

返回:

如果獲得,則返回 ItemAnimation 對象; 如果沒有分配對象,則返回 null。

isListAnimating

public boolean isListAnimating()

檢查此 ListComponent 是否正在運行動畫。

返回:

如果 ListComponent 正在運行動畫,則返回 true; 否則返回 false。

addListAdornment

public void addListAdornment(ListAdornment adorn, int index)

將 ListAdornment 對象添加到此 ListComponent 的指定位置。

參數(shù):

參數(shù)名稱 參數(shù)描述
adorn 指示要添加的 ListAdornment 對象。
index 指示將添加 ListAdornment 對象的位置。 如果此參數(shù)設(shè)置為負值,則 ListAdornment 將添加到 ListComponent 的末尾。

addListAdornment

public void addListAdornment(ListAdornment adorn)

在此 ListComponent 的末尾添加一個 ListAdornment 對象。

參數(shù):

參數(shù)名稱 參數(shù)描述
adorn 指示要添加的 ListAdornment 對象。

getListAdornmentAt

public ListAdornment getListAdornmentAt(int index)

獲取具有此 ListComponent 的給定索引的 ListAdornment 對象。

參數(shù):

參數(shù)名稱 參數(shù)描述
index 指示要獲取的 ListAdornment 對象的索引。

返回:

返回 ListAdornment 對象。

getListAdornmentCount

public int getListAdornmentCount()

獲取此 ListComponent 中的 ListAdornment 對象的數(shù)量。

返回:

返回 ListAdornment 對象的數(shù)量。

removeListAdornmentAt

public void removeListAdornmentAt(int index)

移除具有此 ListComponent 的給定索引的 ListAdornment 對象。

參數(shù):

參數(shù)名稱 參數(shù)描述
index 指示要刪除的 ListAdornment 對象的索引。

removeListAdornment

public void removeListAdornment(ListAdornment decor)

從此 ListComponent 中移除給定的 ListAdornment 對象。

參數(shù):

參數(shù)名稱 參數(shù)描述
decor 指示要刪除的 ListAdornment 對象。

refreshListAdornments

public void refreshListAdornments()

主動刷新此 ListComponent 中的 ListAdornment 對象。

getAdornedBoundryIncludeMargin

public void getAdornedBoundryIncludeMargin(Component component, Rect outBounds)

獲取子組件的邊界,包括其裝飾和邊距。

參數(shù):

參數(shù)名稱 參數(shù)描述
component 表示子組件。
outBounds 表示用于保持邊界的矩形。

postponeLayout

public void postponeLayout(boolean isPostponeLayout)

設(shè)置是否推遲此 ListComponent 的布局請求。

如果布局請求被推遲,ListComponent 的布局和滾動將被禁用。

參數(shù):

參數(shù)名稱 參數(shù)描述
isPostponeLayout 指定是否推遲布局請求。 true 表示推遲布局請求,false 表示相反。

isPostponeLayout

public boolean isPostponeLayout()

檢查此 ListComponent 的布局請求是否被推遲。

返回:

如果布局請求被推遲,則返回 true; 否則返回 false。

setOnFlingListener

public void setOnFlingListener(ListComponent.OnFlingListener listener)

為此 ListComponent 設(shè)置一個 OnFlingListener。 該監(jiān)聽器用于觀察 ListComponent 的 fling 事件。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 指示要設(shè)置的 OnFlingListener。

setRecoverfocusAfterRefresh

public void setRecoverfocusAfterRefresh(boolean recoverFocusAfterRefresh)

設(shè)置此 ListComponent 在布局計算后是否保持同一個子組件的焦點。

參數(shù):

參數(shù)名稱 參數(shù)描述
recoverFocusAfterRefresh 指定 ListComponent 在布局計算后是否保持同一個子組件的焦點。 值 true 表示保持同一個子組件聚焦,false 表示相反。 默認值是true。

getRecoverfocusAfterRefresh

public boolean getRecoverfocusAfterRefresh()

檢查此 ListComponent 在布局計算后是否保持同一個子組件的焦點。

返回:

如果 ListComponent 在布局計算后保持同一個子組件為焦點,則返回 true; 否則返回 false。

postLayout

public void postLayout()

從類復(fù)制的描述:組件

請求重新排列組件的布局。

指定者:

ComponentParent 接口中的 postLayout

覆蓋:

類 Component 中的 postLayout

setReboundEffect

public void setReboundEffect(boolean enabled)

設(shè)置是否開啟反彈效果。

參數(shù):

參數(shù)名稱 參數(shù)描述
enabled 指定是否啟用反彈效果。 true 表示啟用反彈效果,false 表示相反。

getReboundEffect

public boolean getReboundEffect()

檢查反彈效果是否開啟。

返回:

如果啟用了反彈效果,則返回 true; 否則返回 false。

setReboundEffectParams

public void setReboundEffectParams(int overscrollPercent, float overscrollRate, int remainVisiblePercent)

設(shè)置回彈效果參數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
overscrollPercent 表示過度滾動百分比。 默認值為 40。
overscrollRate 表示超滾動率。 默認值為 0.6。
remainVisiblePercent 指示在過度滾動期間應(yīng)保持可見的可滾動內(nèi)容的最小百分比。 默認值為 20。

setReboundEffectParams

public void setReboundEffectParams(ListComponent.ReboundEffectParams reboundEffectParams)

使用 ReboundEffectParams 對象設(shè)置回彈效果參數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
reboundEffectParams 表示一個包含反彈效果參數(shù)的 ReboundEffectParams 對象。

getReboundEffectParams

public ListComponent.ReboundEffectParams getReboundEffectParams()

以 ReboundEffectParams 對象的形式獲取回彈效果參數(shù)。

返回:

返回包含反彈效果參數(shù)的 ReboundEffectParams 對象。

setLayoutManager

public void setLayoutManager(LayoutManager layoutManager)

從類復(fù)制的描述:ComponentContainer

設(shè)置一個 LayoutManager 實例,用于布局相關(guān)子組件。

覆蓋:

ComponentContainer 類中的 setLayoutManager

參數(shù):

參數(shù)名稱 參數(shù)描述
layoutManager 指示要設(shè)置的布局管理器。

isScrollingSmoothly

public boolean isScrollingSmoothly()

檢查此 ListComponent 是否正在平滑滾動。

返回:

如果 ListComponent 正在平滑滾動,則返回 true; 否則返回 false。

verifyLayoutConfig

public ComponentContainer.LayoutConfig verifyLayoutConfig(ComponentContainer.LayoutConfig config)

自定義一個 LayoutConfig 對象,使 ComponentOwner 擁有 ListLayoutManager 的元數(shù)據(jù)。

指定者:

接口 ComponentParent 中的 verifyLayoutConfig

覆蓋:

ComponentContainer 類中的 verifyLayoutConfig

參數(shù):

參數(shù)名稱 參數(shù)描述
config 表示要轉(zhuǎn)換為 ComponentContainer.LayoutConfig 實例的一組布局參數(shù)。

返回:

返回包含布局參數(shù)的 ComponentContainer.LayoutConfig 實例。

onBounceBackStart

public void onBounceBackStart(int xOverScrolled, int yOverScrolled)

反彈開始時調(diào)用。

參數(shù):

參數(shù)名稱 參數(shù)描述
xOverScrolled 表示水平方向移動的距離。
yOverScrolled 表示垂直方向移動的距離。

onBounceBackChange

public void onBounceBackChange(int xOverScrolled, int yOverScrolled)

在反彈過程中調(diào)用。

參數(shù):

參數(shù)名稱 參數(shù)描述
xOverScrolled 表示水平方向移動的距離。
yOverScrolled 表示垂直方向移動的距離。

onBounceBackEnd

public void onBounceBackEnd(int xOverScrolled, int yOverScrolled)

反彈結(jié)束時調(diào)用。

參數(shù):

參數(shù)名稱 參數(shù)描述
xOverScrolled 表示水平方向移動的距離。
yOverScrolled 表示垂直方向移動的距離。

addBounceBackListener

public void addBounceBackListener(ListComponent.BounceBackListener listener)

為反彈狀態(tài)更改添加偵聽器。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 指示要添加的偵聽器。

removeBounceBackListener

public void removeBounceBackListener(ListComponent.BounceBackListener listener)

刪除反彈狀態(tài)更改的偵聽器。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 指示要刪除的偵聽器。

clearBounceBackListeners

public void clearBounceBackListeners()

刪除反彈狀態(tài)更改的所有偵聽器。

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號