日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSListContainer

ListContainer

java.lang.Object

|---ohos.agp.components.Component

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

|---|---|---ohos.agp.components.ListContainer

public class ListContainer
extends ComponentContainer
implements Text.TextObserver

提供在屏幕上向上或向下滾動(dòng)時(shí)顯示的列表容器。

此類繼承自 ComponentContainer。 它使用 BaseItemProvider 來(lái)存儲(chǔ)對(duì)象。

Since:

3

嵌套類摘要

修飾符和類型 描述
static interface ListContainer.ItemClickedListener 偵聽(tīng) ListContainer 項(xiàng)的單擊事件。
static interface ListContainer.ItemLongClickedListener 提供用于偵聽(tīng)和處理 ListContainer 項(xiàng)的長(zhǎng)按事件的偵聽(tīng)器。
static interface ListContainer.ItemSelectedListener 偵聽(tīng) ListContainer 對(duì)象中組件項(xiàng)的選定事件。
static interface ListContainer.ItemVisibilityChangedListener 提供在將組件添加到可見(jiàn)項(xiàng)集中或從可見(jiàn)項(xiàng)集中刪除時(shí)要調(diào)用的回調(diào)。
static class ListContainer.ReboundEffectParams 表示回彈效果參數(shù)。
static interface ListContainer.ScrollListener 表示用于監(jiān)視 ListContainer 對(duì)象滾動(dòng)結(jié)束的內(nèi)部接口。
從類 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 INVALID_INDEX 指示無(wú)效索引。
static float ROTATION_SENSITIVITY_DEFAULT 指示 ListContainer 響應(yīng)旋轉(zhuǎn)表冠事件的默認(rèn)旋轉(zhuǎn)靈敏度。
static float ROTATION_SENSITIVITY_HIGH 表示 ListContainer 響應(yīng)旋轉(zhuǎn)表冠事件的高旋轉(zhuǎn)靈敏度。
static float ROTATION_SENSITIVITY_LOW 指示 ListContainer 響應(yīng)旋轉(zhuǎn)表冠事件的低旋轉(zhuǎn)靈敏度。
從類 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, 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
從類 ohos.agp.components.ComponentContainer 繼承的字段
FOCUS_CHILDREN_FIRST, FOCUS_CHILDREN_HIDE, FOCUS_PARENT_FIRST, mArrangeListener

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

構(gòu)造函數(shù) 描述
ListContainer(Context context) 用于使用默認(rèn)屬性集和樣式創(chuàng)建 ListContainer 實(shí)例的默認(rèn)構(gòu)造函數(shù)。
ListContainer(Context context, AttrSet attrSet) 用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 ListContainer 實(shí)例的構(gòu)造函數(shù)。
ListContainer(Context context, AttrSet attrSet, String styleName) 用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 ListContainer 實(shí)例的構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型 方法 描述
void addComponent(Component childComponent) 通過(guò)在內(nèi)部調(diào)用 ComponentContainer.addComponent(ohos.agp.components.Component,int index) 將組件添加到隊(duì)列的末尾。
void addComponent(Component childComponent, int index) 將組件添加到指定位置。
void addComponent(Component childComponent, int width, int height) 添加一個(gè)組件并設(shè)置其寬度和高度。
void addComponent(Component childComponent, int index, ComponentContainer.LayoutConfig layoutConfig) 添加組件并設(shè)置其布局參數(shù)和位置。
void addComponent(Component childComponent, ComponentContainer.LayoutConfig layoutConfig) 添加一個(gè)組件并設(shè)置其布局參數(shù)。
void addItemVisibilityChangedListener(ListContainer.ItemVisibilityChangedListener listener) 將 ItemVisibilityChangedListener 添加到偵聽(tīng)器列表中。
boolean executeItemClick(Component component, int position, long id) 處理組件項(xiàng)的單擊事件。
T findComponentById(int id) 查找具有給定 ID 的組件。
Element getBoundary() 獲取用作列表自定義邊界的 Element 對(duì)象。
Color getBoundaryColor() 獲取此 ListContainer 對(duì)象的邊界顏色。
boolean getBoundarySwitch() 指定是否啟用邊界繪制。
int getBoundaryThickness() 獲取邊界線的粗細(xì)。
int getCenterFocusablePosition() 獲取位于組件中心的可聚焦項(xiàng)的位置索引。
int getChildCount() 獲取可以通過(guò) setItemProvider(ohos.agp.components.BaseItemProvider) 設(shè)置的提供程序中的數(shù)據(jù)項(xiàng)總數(shù)。
Component getComponentAt(int position) 按位置從可見(jiàn)項(xiàng)集合中獲取組件。
int getContentEndOffset() 獲取列表容器的結(jié)束偏移量。
int getContentStartOffset() 獲取列表容器的起始偏移量。
int getExtraItemsNumber() 獲取添加到可見(jiàn)區(qū)域之外的頂部和底部或左側(cè)和右側(cè)(取決于 ListContainer 方向)的額外項(xiàng)目數(shù)。
int getFirstVisibleItemPosition() 已棄用。 此更改從 API 版本 5 開(kāi)始生效。替換為 getItemPosByVisibleIndex(int)
boolean getFooterBoundarySwitch() 檢查是否為頁(yè)腳組件啟用了邊界繪制。
boolean getHeaderBoundarySwitch() 檢查是否為標(biāo)題組件啟用了邊界繪制。
int getIndexForComponent(Component component) 獲取組件項(xiàng)在 ListContainer 對(duì)象中的位置。
int getItemPosByVisibleIndex(int index) 獲取可見(jiàn)項(xiàng)的位置索引。
BaseItemProvider getItemProvider() 獲取與 ListContainer 對(duì)象關(guān)聯(lián)的 BaseItemProvider 對(duì)象。
int getLastVisibleItemPosition() 已棄用。 此更改從 API 版本 5 開(kāi)始生效。在傳遞等于 getVisibleIndexCount() 減 1 的值時(shí)由 getItemPosByVisibleIndex(int) 替換。
int getOrientation() 獲取布局的方向。
boolean getReboundEffect() 獲取反彈效果的狀態(tài)。
ListContainer.ReboundEffectParams getReboundEffectParams() 獲取反彈參數(shù)作為 ReboundEffectParams 對(duì)象。
int getSelectedItemIndex() 獲取所選組件項(xiàng)的位置。
Color getShaderColor() 獲取此 ListContainer 對(duì)象的著色器顏色。
String getTextFilter() 獲取文本過(guò)濾器。
int getVisibleIndexCount() 獲取提供程序數(shù)據(jù)集的最后一個(gè)和第一個(gè)可見(jiàn)項(xiàng)之間的大小差異。
void moveChildToFront(Component component) 將子組件置于最前面。
protected boolean onItemLongClicked(ListContainer parent, Component component, int position, long id) 當(dāng)組件項(xiàng)被長(zhǎng)按時(shí)調(diào)用。
protected void onItemSelected(ListContainer parent, Component component, int position, long id) 選擇 ListContainer 對(duì)象中的組件項(xiàng)時(shí)調(diào)用。
void onTextUpdated(String text, int start, int before, int count) 文本更改時(shí)回調(diào)。
void removeAllComponents() 清除 ComponentContainer 管理的所有組件。
void removeComponent(Component component) 從父組件中移除子組件。
void removeComponentAt(int index) 從組件列表中的指定位置移除組件。
void removeComponentById(int id) 根據(jù) ID 移除組件。
void removeComponents(int start, int count) 從組件列表中的指定位置移除所有組件。
void removeItemVisibilityChangedListener(ListContainer.ItemVisibilityChangedListener listener) 從偵聽(tīng)器列表中刪除 ItemVisibilityChangedListener。
void scrollTo(int position) 滾動(dòng)到列表容器中的指定組件項(xiàng)。
void scrollToCenter(int position) 將列表容器中的指定項(xiàng)目滾動(dòng)到中心。
void setBoundary(Element boundary) 設(shè)置將在列表中的項(xiàng)目之間繪制的元素邊界。
void setBoundaryColor(Color color) 設(shè)置此 ListContainer 對(duì)象的邊界顏色。
void setBoundarySwitch(boolean boundaryEnabled) 設(shè)置是否啟用組件的邊界繪制。
void setBoundaryThickness(int thickness) 設(shè)置邊界線的粗細(xì)。
void setContentEndOffSet(int endOffset) 設(shè)置列表容器的結(jié)束偏移量。
void setContentOffSet(int startOffset, int endOffset) 設(shè)置列表容器的開(kāi)始和結(jié)束偏移量。
void setContentStartOffSet(int startOffset) 設(shè)置列表容器的起始偏移量。
void setExtraItemsNumber(int number) 設(shè)置添加到可見(jiàn)區(qū)域之外的頂部和底部或左側(cè)和右側(cè)(取決于 ListContainer 方向)的額外項(xiàng)目的數(shù)量。
void setFooterBoundarySwitch(boolean footerBoundaryEnabled) 設(shè)置是否為頁(yè)腳組件啟用邊界繪制。
void setHeaderBoundarySwitch(boolean headerBoundaryEnabled) 設(shè)置是否為標(biāo)題組件啟用邊界繪制。
void setItemClickedListener(ListContainer.ItemClickedListener listener) 為組件項(xiàng)設(shè)置單擊偵聽(tīng)器。
void setItemLongClickedListener(ListContainer.ItemLongClickedListener listener) 為組件項(xiàng)設(shè)置長(zhǎng)按偵聽(tīng)器。
void setItemProvider(BaseItemProvider itemProvider) 設(shè)置 BaseItemProvider 對(duì)象以向 ListContainer 對(duì)象提供要顯示的組件。
void setItemSelectedListener(ListContainer.ItemSelectedListener listener) 為組件項(xiàng)設(shè)置選定的偵聽(tīng)器。
void setLayoutManager(LayoutManager layoutManager) 設(shè)置一個(gè) LayoutManager 實(shí)例,用于布局相關(guān)子組件。
void setOrientation(int orientation) 設(shè)置布局的方向。
void setReboundEffect(boolean enabled) 設(shè)置是否開(kāi)啟反彈效果。
void setReboundEffectParams(int overscrollPercent, float overscrollRate, int remainVisiblePercent) 配置回彈效果參數(shù)。
void setReboundEffectParams(ListContainer.ReboundEffectParams reboundEffectParams) 設(shè)置回彈效果參數(shù)。
void setScrollListener(ListContainer.ScrollListener listener) 設(shè)置偵聽(tīng)器以監(jiān)視 ListContainer 對(duì)象的滾動(dòng)結(jié)束。
void setSelectedItemIndex(int index) 根據(jù)輸入位置選擇組件項(xiàng)。
void setShaderColor(Color color) 設(shè)置此 ListContainer 對(duì)象的著色器顏色。
void setTextFilter(String filterText) 設(shè)置文本過(guò)濾器。
從類 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, 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, unsubscribeVoiceEvents
從類 ohos.agp.components.ComponentContainer 繼承的方法
createLayoutConfig, dispatchRestoreState, dispatchSaveState, findComponentHolderById, getAutoLayout, getChildIndex, getComponentTransition, getFocusOrder, getLayoutManager, informConfigurationChanged, isClipToChildBoundsEnabled, isClipToPaddingBoundsEnabled, isTouchEventSplitable, onDrag, setArrangeListener, setAutoLayout, setAutoLayout, setClipToChildBoundsEnabled, setClipToPaddingBoundsEnabled, setComponentTransition, setFocusOrder, setTouchEventSplitable, verifyLayoutConfig
從接口 ohos.agp.components.ComponentParent 繼承的方法
getComponentParent, postLayout
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

字段詳細(xì)信息

INVALID_INDEX

public static final int INVALID_INDEX

指示無(wú)效索引。

索引只有在其索引為從 0 到組件項(xiàng)總數(shù)之間的整數(shù)時(shí)才有效。

ROTATION_SENSITIVITY_DEFAULT

public static final float ROTATION_SENSITIVITY_DEFAULT

指示 ListContainer 響應(yīng)旋轉(zhuǎn)表冠事件的默認(rèn)旋轉(zhuǎn)靈敏度。 您可以使用 Component.setRotationSensitivity(float) 進(jìn)行設(shè)置。

ROTATION_SENSITIVITY_HIGH

public static final float ROTATION_SENSITIVITY_HIGH

表示 ListContainer 響應(yīng)旋轉(zhuǎn)表冠事件的高旋轉(zhuǎn)靈敏度。 您可以使用 Component.setRotationSensitivity(float) 進(jìn)行設(shè)置。

ROTATION_SENSITIVITY_LOW

public static final float ROTATION_SENSITIVITY_LOW

指示 ListContainer 響應(yīng)旋轉(zhuǎn)表冠事件的低旋轉(zhuǎn)靈敏度。 您可以使用 Component.setRotationSensitivity(float) 進(jìn)行設(shè)置。

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

ListContainer

public ListContainer(Context context)

用于使用默認(rèn)屬性集和樣式創(chuàng)建 ListContainer 實(shí)例的默認(rèn)構(gòu)造函數(shù)。

參數(shù):

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

ListContainer

public ListContainer(Context context, AttrSet attrSet)

用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 ListContainer 實(shí)例的構(gòu)造函數(shù)。

參數(shù):

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

ListContainer

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

用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 ListContainer 實(shí)例的構(gòu)造函數(shù)。

參數(shù):

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

方法詳情

setLayoutManager

public void setLayoutManager(LayoutManager layoutManager)

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

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

覆蓋:

ComponentContainer 類中的 setLayoutManager

參數(shù):

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

onTextUpdated

public void onTextUpdated(String text, int start, int before, int count)

文本更改時(shí)回調(diào)。

該方法用于處理變化的文本,例如驗(yàn)證輸入的LOV得到LOVE,其中text為L(zhǎng)OVE,start為3,before為3,count為1。

指定者:

接口 Text.TextObserver 中的 onTextUpdated

參數(shù):

參數(shù)名稱 參數(shù)描述
text 表示當(dāng)前文本。
start 指示要添加的文本的起始位置。
before 表示舊文本的長(zhǎng)度。
count 表示要添加的文本的長(zhǎng)度。

scrollTo

public void scrollTo(int position)

滾動(dòng)到列表容器中的指定組件項(xiàng)。

參數(shù):

參數(shù)名稱 參數(shù)描述
position 表示指定組件項(xiàng)的位置索引。

setContentStartOffSet

public void setContentStartOffSet(int startOffset)

設(shè)置列表容器的起始偏移量。

參數(shù):

參數(shù)名稱 參數(shù)描述
startOffset 指示要設(shè)置的起始偏移量。

Since:

4

setContentEndOffSet

public void setContentEndOffSet(int endOffset)

設(shè)置列表容器的結(jié)束偏移量。

參數(shù):

參數(shù)名稱 參數(shù)描述
endOffset 指示要設(shè)置的結(jié)束偏移量。

Since:

4

setContentOffSet

public void setContentOffSet(int startOffset, int endOffset)

設(shè)置列表容器的開(kāi)始和結(jié)束偏移量。

參數(shù):

參數(shù)名稱 參數(shù)描述
startOffset 指示要設(shè)置的起始偏移量。
endOffset 指示要設(shè)置的結(jié)束偏移量。

Since:

4

getContentStartOffset

public int getContentStartOffset()

獲取列表容器的起始偏移量。

返回:

返回起始偏移量。

Since:

4

getContentEndOffset

public int getContentEndOffset()

獲取列表容器的結(jié)束偏移量。

返回:

返回結(jié)束偏移量。

Since:

4

scrollToCenter

public void scrollToCenter(int position)

將列表容器中的指定項(xiàng)目滾動(dòng)到中心。

參數(shù):

參數(shù)名稱 參數(shù)描述
position 表示指定組件項(xiàng)的位置索引。

setItemClickedListener

public void setItemClickedListener(ListContainer.ItemClickedListener listener)

為組件項(xiàng)設(shè)置單擊偵聽(tīng)器。

該方法繼承自ItemClickedListener,用于處理組件項(xiàng)的點(diǎn)擊事件。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 表示點(diǎn)擊監(jiān)聽(tīng)。

executeItemClick

public boolean executeItemClick(Component component, int position, long id)

處理組件項(xiàng)的單擊事件。

該方法僅在為組件項(xiàng)設(shè)置了點(diǎn)擊監(jiān)聽(tīng)時(shí)有效。

參數(shù):

參數(shù)名稱 參數(shù)描述
component 表示被點(diǎn)擊的組件項(xiàng)。
position 表示被點(diǎn)擊的組件項(xiàng)的位置。
id 表示被點(diǎn)擊的組件項(xiàng)的行ID。

返回:

如果設(shè)置了點(diǎn)擊監(jiān)聽(tīng)并處理了點(diǎn)擊事件,則返回true; 否則返回 false。

Since:

4

setItemLongClickedListener

public void setItemLongClickedListener(ListContainer.ItemLongClickedListener listener)

為組件項(xiàng)設(shè)置長(zhǎng)按偵聽(tīng)器。

該方法繼承自ItemLongClickedListener,用于處理組件項(xiàng)的長(zhǎng)按事件。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 表示長(zhǎng)按監(jiān)聽(tīng)。

onItemLongClicked

protected boolean onItemLongClicked(ListContainer parent, Component component, int position, long id)

當(dāng)組件項(xiàng)被長(zhǎng)按時(shí)調(diào)用。

調(diào)用該方法處理組件項(xiàng)的長(zhǎng)按事件。

參數(shù):

參數(shù)名稱 參數(shù)描述
parent 指示 ListContainer 對(duì)象。
component 表示長(zhǎng)按的組件項(xiàng)。
position 指示長(zhǎng)按組件項(xiàng)的位置。
id 表示長(zhǎng)按組件項(xiàng)的行ID。

返回:

如果處理了長(zhǎng)按事件,則返回 true; 否則返回 false。

setScrollListener

public void setScrollListener(ListContainer.ScrollListener listener)

設(shè)置偵聽(tīng)器以監(jiān)視 ListContainer 對(duì)象的滾動(dòng)結(jié)束。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 表示一個(gè) ListContainer.ScrollListener 對(duì)象,表示要設(shè)置的監(jiān)聽(tīng)器。

Since:

4

setItemSelectedListener

public void setItemSelectedListener(ListContainer.ItemSelectedListener listener)

為組件項(xiàng)設(shè)置選定的偵聽(tīng)器。

該方法繼承自ItemSelectedListener,被調(diào)用來(lái)處理組件項(xiàng)的選定事件。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 表示選擇的監(jiān)聽(tīng)器。

onItemSelected

protected void onItemSelected(ListContainer parent, Component component, int position, long id)

選擇 ListContainer 對(duì)象中的組件項(xiàng)時(shí)調(diào)用。

參數(shù):

參數(shù)名稱 參數(shù)描述
parent 指示 ListContainer 對(duì)象。
component 表示選中的組件項(xiàng)。
position 指示所選組件項(xiàng)的位置。
id 表示所選組件項(xiàng)的行 ID。

findComponentById

public T findComponentById(int id)

查找具有給定 ID 的組件。

如果當(dāng)前組件本身的 ID 與給定 ID 匹配,則返回當(dāng)前組件。 否則,返回 null。

覆蓋:

ComponentContainer 類中的 findComponentById

參數(shù):

參數(shù)名稱 參數(shù)描述
id 表示組件的唯一標(biāo)識(shí)符。

返回:

返回 ID 與給定 ID 匹配的組件; 如果沒(méi)有找到組件,則返回 null。

addComponent

public void addComponent(Component childComponent)

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

覆蓋:

類 ComponentContainer 中的 addComponent

參數(shù):

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

Throws:

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

addComponent

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

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

覆蓋:

類 ComponentContainer 中的 addComponent

參數(shù):

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

Throws:

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

addComponent

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

添加一個(gè)組件并設(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 表示將子組件添加到隊(duì)列的末尾。
layoutConfig 表示子組件的布局參數(shù)。

Throws:

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

addComponent

public void addComponent(Component childComponent, int index)

將組件添加到指定位置。

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

覆蓋:

類 ComponentContainer 中的 addComponent

參數(shù):

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

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 表示第一個(gè)移除的組件的位置索引。
count 表示要移除的組件數(shù)量。

Throws:

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

removeAllComponents

public void removeAllComponents()

清除 ComponentContainer 管理的所有組件。

覆蓋:

ComponentContainer 類中的 removeAllComponents

Throws:

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

getChildCount

public int getChildCount()

獲取可以通過(guò) setItemProvider(ohos.agp.components.BaseItemProvider) 設(shè)置的提供程序中的數(shù)據(jù)項(xiàng)總數(shù)。

覆蓋:

ComponentContainer 類中的 getChildCount

返回:

返回提供程序中的數(shù)據(jù)項(xiàng)總數(shù)。

Since:

5

getComponentAt

public Component getComponentAt(int position)

按位置從可見(jiàn)項(xiàng)集合中獲取組件。 如果 Component 不在可見(jiàn)項(xiàng)集中,則返回 null。

可以使用 ItemVisibilityChangedListener 檢查是否在組件從可見(jiàn)項(xiàng)目集中刪除之前獲得。

覆蓋:

類 ComponentContainer 中的 getComponentAt

參數(shù):

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

返回:

如果組件可見(jiàn),則按位置返回,否則返回 null。

Since:

5

setExtraItemsNumber

public void setExtraItemsNumber(int number)

設(shè)置添加到可見(jiàn)區(qū)域之外的頂部和底部或左側(cè)和右側(cè)(取決于 ListContainer 方向)的額外項(xiàng)目的數(shù)量。 默認(rèn)值為 0。

參數(shù):

參數(shù)名稱 參數(shù)描述
number 表示額外項(xiàng)目的數(shù)量。

Throws:

Throw名稱 Throw描述
IllegalArgumentException 如果 number 為負(fù)數(shù),則拋出此異常。

Since:

5

getExtraItemsNumber

public int getExtraItemsNumber()

獲取添加到可見(jiàn)區(qū)域之外的頂部和底部或左側(cè)和右側(cè)(取決于 ListContainer 方向)的額外項(xiàng)目數(shù)。

返回:

返回額外項(xiàng)目的數(shù)量。

Since:

5

addItemVisibilityChangedListener

public void addItemVisibilityChangedListener(ListContainer.ItemVisibilityChangedListener listener)

將 ItemVisibilityChangedListener 添加到偵聽(tīng)器列表中。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 指示 ItemVisibilityChangedListener。

Since:

5

removeItemVisibilityChangedListener

public void removeItemVisibilityChangedListener(ListContainer.ItemVisibilityChangedListener listener)

從偵聽(tīng)器列表中刪除 ItemVisibilityChangedListener。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener 指示 ItemVisibilityChangedListener。

Since:

5

getIndexForComponent

public int getIndexForComponent(Component component)

獲取組件項(xiàng)在 ListContainer 對(duì)象中的位置。

參數(shù):

參數(shù)名稱 參數(shù)描述
component 指示與 Component 項(xiàng)匹配的 BaseItemProvider 項(xiàng)。

返回:

返回 Component 項(xiàng)在 ListContainer 對(duì)象中的位置; 如果 Component 項(xiàng)不可見(jiàn)或未包含在 ListContainer 對(duì)象中,則返回 INVALID_INDEX。

Since:

4

getLastVisibleItemPosition

@Deprecated public int getLastVisibleItemPosition()

已棄用。 此更改從 API 版本 5 開(kāi)始生效。在傳遞等于 getVisibleIndexCount() 減 1 的值時(shí)由 getItemPosByVisibleIndex(int) 替換。

獲取提供者數(shù)據(jù)集中最后一個(gè)可見(jiàn)項(xiàng)的位置索引。

返回:

返回提供者數(shù)據(jù)集中最后一個(gè)可見(jiàn)項(xiàng)的位置索引。

Since:

5

getFirstVisibleItemPosition

@Deprecated public int getFirstVisibleItemPosition()

已棄用。 此更改從 API 版本 5 開(kāi)始生效。替換為 getItemPosByVisibleIndex(int)

獲取提供者數(shù)據(jù)集中第一個(gè)可見(jiàn)項(xiàng)的位置索引。

返回:

返回提供者數(shù)據(jù)集中第一個(gè)可見(jiàn)項(xiàng)的位置索引。

Since:

5

getItemPosByVisibleIndex

public int getItemPosByVisibleIndex(int index)

獲取可見(jiàn)項(xiàng)的位置索引。

參數(shù):

參數(shù)名稱 參數(shù)描述
index 表示可見(jiàn)項(xiàng)的索引。

返回:

返回可見(jiàn)項(xiàng)的位置索引。

Since:

5

getVisibleIndexCount

public int getVisibleIndexCount()

獲取提供程序數(shù)據(jù)集的最后一個(gè)和第一個(gè)可見(jiàn)項(xiàng)之間的大小差異。

返回:

返回大小差異。

Since:

5

getCenterFocusablePosition

public int getCenterFocusablePosition()

獲取位于組件中心的可聚焦項(xiàng)的位置索引。

返回:

如果提供者數(shù)據(jù)集中存在可聚焦項(xiàng)目,則返回組件中心的位置索引,如果不存在則返回 -1。

Since:

3

setReboundEffect

public void setReboundEffect(boolean enabled)

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

參數(shù):

參數(shù)名稱 參數(shù)描述
enabled 指定是否啟用反彈效果。 true 表示開(kāi)啟反彈效果; false 表示關(guān)閉反彈效果。

Since:

3

getReboundEffect

public boolean getReboundEffect()

獲取反彈效果的狀態(tài)。

返回:

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

Since:

3

setShaderColor

public void setShaderColor(Color color)

設(shè)置此 ListContainer 對(duì)象的著色器顏色。

參數(shù):

參數(shù)名稱 參數(shù)描述
color 指示要設(shè)置的著色器顏色。

Since:

3

getShaderColor

public Color getShaderColor()

獲取此 ListContainer 對(duì)象的著色器顏色。

返回:

返回著色器顏色。

Since:

3

setOrientation

public void setOrientation(int orientation)

設(shè)置布局的方向。

參數(shù):

參數(shù)名稱 參數(shù)描述
orientation 將用于布局的方向。 Component#HORIZONTAL 或 Component#VERTICAL 都適用。

Since:

3

setBoundary

public void setBoundary(Element boundary)

設(shè)置將在列表中的項(xiàng)目之間繪制的元素邊界。

參數(shù):

參數(shù)名稱 參數(shù)描述
boundary 指示要用作自定義邊界的 Element 對(duì)象。 null 表示要使用默認(rèn)邊界。

Since:

5

getBoundary

public Element getBoundary()

獲取用作列表自定義邊界的 Element 對(duì)象。

返回:

返回元素對(duì)象。

Since:

5

setFooterBoundarySwitch

public void setFooterBoundarySwitch(boolean footerBoundaryEnabled)

設(shè)置是否為頁(yè)腳組件啟用邊界繪制。

參數(shù):

參數(shù)名稱 參數(shù)描述
footerBoundaryEnabled 指定是否為頁(yè)腳組件啟用邊界繪制。 true 表示啟用邊界繪制,false 表示相反的情況。

Since:

5

getFooterBoundarySwitch

public boolean getFooterBoundarySwitch()

檢查是否為頁(yè)腳組件啟用了邊界繪制。

返回:

如果啟用了邊界繪制,則返回 true; 否則返回 false。

Since:

5

setHeaderBoundarySwitch

public void setHeaderBoundarySwitch(boolean headerBoundaryEnabled)

設(shè)置是否為標(biāo)題組件啟用邊界繪制。

參數(shù):

參數(shù)名稱 參數(shù)描述
headerBoundaryEnabled 指定是否為標(biāo)題組件啟用邊界繪制。 true 表示啟用邊界繪制,false 表示相反的情況。

Since:

5

getHeaderBoundarySwitch

public boolean getHeaderBoundarySwitch()

檢查是否為標(biāo)題組件啟用了邊界繪制。

返回:

如果啟用了邊界繪制,則返回 true; 否則返回 false。

Since:

5

setBoundarySwitch

public void setBoundarySwitch(boolean boundaryEnabled)

設(shè)置是否啟用組件的邊界繪制。

參數(shù):

參數(shù)名稱 參數(shù)描述
boundaryEnabled 指定是否啟用組件的邊界繪制。 true 表示啟用邊界繪制,false 表示相反的情況。

Since:

5

getBoundarySwitch

public boolean getBoundarySwitch()

指定是否啟用邊界繪制。

返回:

如果啟用了邊界繪制,則返回 true; 否則返回 false。

Since:

5

setBoundaryColor

public void setBoundaryColor(Color color)

設(shè)置此 ListContainer 對(duì)象的邊界顏色。

參數(shù):

參數(shù)名稱 參數(shù)描述
color 指示要設(shè)置的邊界顏色。

Since:

5

getBoundaryColor

public Color getBoundaryColor()

獲取此 ListContainer 對(duì)象的邊界顏色。

返回:

返回邊界顏色。

Since:

5

setBoundaryThickness

public void setBoundaryThickness(int thickness)

設(shè)置邊界線的粗細(xì)。

參數(shù):

參數(shù)名稱 參數(shù)描述
thickness 表示邊界厚度,以像素為單位。

Since:

5

getBoundaryThickness

public int getBoundaryThickness()

獲取邊界線的粗細(xì)。

返回:

返回邊界厚度,以像素為單位。

Since:

5

setSelectedItemIndex

public void setSelectedItemIndex(int index)

根據(jù)輸入位置選擇組件項(xiàng)。

參數(shù):

參數(shù)名稱 參數(shù)描述
index 表示要選擇的組件項(xiàng)的位置,為非負(fù)整數(shù)。

Since:

4

getSelectedItemIndex

public int getSelectedItemIndex()

獲取所選組件項(xiàng)的位置。

返回:

返回所選組件項(xiàng)的位置; 如果未選擇任何組件項(xiàng),則返回 INVALID_INDEX。

Since:

4

setTextFilter

public void setTextFilter(String filterText)

設(shè)置文本過(guò)濾器。

參數(shù):

參數(shù)名稱 參數(shù)描述
filterText 指示要使用的文本過(guò)濾器。

getTextFilter

public String getTextFilter()

獲取文本過(guò)濾器。

返回:

返回文本過(guò)濾器。

Since:

4

getItemProvider

public BaseItemProvider getItemProvider()

獲取與 ListContainer 對(duì)象關(guān)聯(lián)的 BaseItemProvider 對(duì)象。

返回:

返回關(guān)聯(lián)的 BaseItemProvider 對(duì)象。

setItemProvider

public void setItemProvider(BaseItemProvider itemProvider)

設(shè)置 BaseItemProvider 對(duì)象以向 ListContainer 對(duì)象提供要顯示的組件。

參數(shù):

參數(shù)名稱 參數(shù)描述
itemProvider 指示 BaseItemProvider 對(duì)象。

getOrientation

public int getOrientation()

獲取布局的方向。

返回:

用于布局的方向。

Since:

3

setReboundEffectParams

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

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

參數(shù):

<object id="y8wh2"></object>
  • <small id="y8wh2"></small>
    <small id="y8wh2"></small>
  • 參數(shù)名稱 參數(shù)描述
    overscrollPercent 表示過(guò)度滾動(dòng)百分比(默認(rèn)值:40)。 如果滾動(dòng)內(nèi)容的百分比超過(guò)該參數(shù)的值,則內(nèi)容滾動(dòng)速度受 overscrollRate 參數(shù)的影響。 具體來(lái)說(shuō),如果 overscrollRate 的值小于 1.0,則您的手指移動(dòng)速度快于內(nèi)容。
    overscrollRate 表示過(guò)度滾動(dòng)率(默認(rèn)值:0.6)。 如果滾動(dòng)內(nèi)容的百分比超過(guò) overscrollPercent 參數(shù)的值,此參數(shù)會(huì)影響內(nèi)容滾動(dòng)速度。 具體來(lái)說(shuō),內(nèi)容滾動(dòng)
    網(wǎng)站題目:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSListContainer
    路徑分享:http://www.5511xx.com/article/cceojhp.html