新聞中心
TabList

成都創(chuàng)新互聯(lián)公司自2013年創(chuàng)立以來,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢想脫穎而出為使命,1280元松嶺做網(wǎng)站,已為上家服務(wù),為松嶺各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575
java.lang.Object
|---ohos.agp.components.Component
|---|---ohos.agp.components.ComponentContainer
|---|---|---ohos.agp.components.StackLayout
|---|---|---|---ohos.agp.components.ScrollView
|---|---|---|---|---ohos.agp.components.TabList
public class TabList
extends ScrollView顯示選項(xiàng)卡的方向布局,并允許布局中的內(nèi)容沿布局方向滾動。
您可以使用 TabList 對象創(chuàng)建選項(xiàng)卡,然后使用 addTab(ohos.agp.components.TabList.Tab) 將新選項(xiàng)卡添加到列表中。 布局方向可以是 Component.HORIZONTAL 或 Component.VERTICAL。 默認(rèn)方向是水平的。
Since:
3
嵌套類摘要
| 修飾符和類型 | 類 | 描述 |
|---|---|---|
| class | TabList.Tab | 表示 TabList 中的選項(xiàng)卡。 |
| static interface | TabList.TabSelectedListener | 提供選項(xiàng)卡選擇的偵聽器。 |
| 從類 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 |
| 從類 ohos.agp.components.ScrollView 繼承的嵌套類/接口 |
|---|
| ScrollView.ReboundEffectParams |
| 從類 ohos.agp.components.StackLayout 繼承的嵌套類/接口 |
|---|
| StackLayout.LayoutConfig |
字段摘要
| 修飾符和類型 | 字段 | 描述 |
|---|---|---|
| static int | INDICATOR_BOTTOM_LINE | 表示選擇指示器是選項(xiàng)卡的底線。 |
| static int | INDICATOR_INVISIBLE | 表示選擇指示器已隱藏。 |
| static int | INDICATOR_LEFT_LINE | 表示選擇指示器是選項(xiàng)卡左側(cè)的垂直線。 |
| static int | INDICATOR_OVAL | 指示選擇指示器是選項(xiàng)卡上的橢圓形背景。 |
| 從類 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 |
| 從類 ohos.agp.components.ScrollView 繼承的字段 |
|---|
| ROTATION_SENSITIVITY_DEFAULT, ROTATION_SENSITIVITY_HIGH, ROTATION_SENSITIVITY_LOW |
構(gòu)造函數(shù)摘要
| 構(gòu)造函數(shù) | 描述 |
|---|---|
| TabList(Context context) | 默認(rèn)構(gòu)造函數(shù)用于使用默認(rèn)屬性集和樣式創(chuàng)建 TabList 實(shí)例。 |
| TabList(Context context, AttrSet attrSet) | 用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 TabList 實(shí)例的構(gòu)造函數(shù)。 |
| TabList(Context context, AttrSet attrSet, String styleName) | 用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 TabList 實(shí)例的構(gòu)造函數(shù)。 |
方法總結(jié)
| 修飾符和類型 | 方法 | 描述 |
|---|---|---|
| void | addTab(TabList.Tab tab) | 在當(dāng)前布局的末尾添加一個(gè)選項(xiàng)卡。 |
| void | addTab(TabList.Tab tab, boolean selected) | 在當(dāng)前布局的末尾添加一個(gè)選項(xiàng)卡并指定它是否被選中。 |
| void | addTab(TabList.Tab tab, int pos) | 將選項(xiàng)卡添加到當(dāng)前布局中的指定位置。 |
| void | addTab(TabList.Tab tab, int pos, boolean selected) | 將選項(xiàng)卡添加到當(dāng)前布局中的某個(gè)位置并指定它是否被選中。 |
| void | addTabSelectedListener(TabList.TabSelectedListener listener) | 將選定的偵聽器添加到列表中的選項(xiàng)卡。 |
| int | getIndicatorType() | 獲取選項(xiàng)卡指示器類型。 |
| int | getNormalTabTextColor() | 獲取該選項(xiàng)卡處于正常狀態(tài)時(shí)的文本顏色。 |
| int | getOrientation() | 獲取布局方向。 |
| TabList.Tab | getSelectedTab() | 獲取組件中選定的選項(xiàng)卡。 |
| int | getSelectedTabIndex() | 獲取選定選項(xiàng)卡在組件中的位置。 |
| int | getSelectedTabIndicatorColor() | 獲取所選標(biāo)簽指示器的顏色。 |
| int | getSelectedTabIndicatorHeight() | 獲取所選標(biāo)簽指示器的高度。 |
| int | getSelectedTabTextColor() | 獲取該選項(xiàng)卡被選中時(shí)的文本顏色。 |
| TabList.Tab | getTabAt(int pos) | 獲取指定位置的選項(xiàng)卡。 |
| int | getTabCount() | 獲取組件中的選項(xiàng)卡數(shù)。 |
| int | getTabLength() | 獲取表中所有標(biāo)簽的長度,為非負(fù)整數(shù)。 |
| int | getTabMargin() | 獲取表格中兩個(gè)相鄰選項(xiàng)卡之間的邊距(以像素為單位)。 |
| int | getTabTextAlignment() | 獲取表格的文本對齊方式。 |
| int | getTabTextSize() | 獲取表格的文本大小。 |
| boolean | isFixedMode() | 獲取是否開啟固定模式。 |
| void | removeAllComponents() | 從當(dāng)前組件中刪除所有選項(xiàng)卡。 |
| void | removeTab(int pos) | 從指定位置刪除選項(xiàng)卡。 |
| void | removeTab(TabList.Tab tab) | 刪除選項(xiàng)卡。 |
| void | removeTabSelectedListener(TabList.TabSelectedListener listener) | 從布局中的選項(xiàng)卡中刪除選定事件的偵聽器。 |
| void | selectTab(TabList.Tab tab) | 選擇一個(gè)選項(xiàng)卡。 |
| void | selectTabAt(int pos) | 選擇表中指定位置的選項(xiàng)卡。 |
| void | setFixedMode(boolean isFixed) | 設(shè)置是否修復(fù)所有選項(xiàng)卡并同時(shí)顯示它們。 |
| void | setIndicatorType(int type) | 設(shè)置選項(xiàng)卡指示器類型。 |
| void | setOrientation(int orientation) | 設(shè)置布局方向。 |
| void | setSelectedTabIndicatorColor(int color) | 設(shè)置選定選項(xiàng)卡的顏色。 |
| void | setSelectedTabIndicatorHeight(int height) | 設(shè)置選定選項(xiàng)卡的高度。 |
| void | setTabLength(int length) | 設(shè)置布局中所有選項(xiàng)卡的寬度或高度。 |
| void | setTabMargin(int margin) | 設(shè)置組件中兩個(gè)選項(xiàng)卡之間的邊距。 |
| void | setTabTextAlignment(int alignment) | 設(shè)置組件中所有選項(xiàng)卡的文本對齊方式。 |
| void | setTabTextColors(int normal, int selected) | 設(shè)置選定和取消選定選項(xiàng)卡的文本顏色。 |
| void | setTabTextSize(int size) | 設(shè)置組件中所有選項(xiàng)卡的文本大小。 |
| 從類 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 繼承的方法 |
|---|
| addComponent, addComponent, addComponent, addComponent, addComponent, dispatchRestoreState, dispatchSaveState, findComponentById, findComponentHolderById, getAutoLayout, getChildCount, getChildIndex, getComponentAt, getComponentTransition, getFocusOrder, getLayoutManager, informConfigurationChanged, isClipToChildBoundsEnabled, isClipToPaddingBoundsEnabled, isTouchEventSplitable, moveChildToFront, onDrag, removeComponent, removeComponentAt, removeComponentById, removeComponents, setArrangeListener, setAutoLayout, setAutoLayout, setClipToChildBoundsEnabled, setClipToPaddingBoundsEnabled, setComponentTransition, setFocusOrder, setLayoutManager, setTouchEventSplitable |
| 從接口 ohos.agp.components.ComponentParent 繼承的方法 |
|---|
| getComponentParent, postLayout |
| 從類 java.lang.Object 繼承的方法 |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 從類 ohos.agp.components.ScrollView 繼承的方法 |
|---|
| addScrollPausePositionX, addScrollPausePositionY, doFling, doFlingX, doFlingY, fluentScrollBy, fluentScrollByX, fluentScrollByY, fluentScrollTo, fluentScrollXTo, fluentScrollYTo, getReboundEffect, getReboundEffectParams, isMatchViewport, setMatchViewportEnabled, setReboundEffect, setReboundEffectParams, setReboundEffectParams |
| 從類 ohos.agp.components.StackLayout 繼承的方法 |
|---|
| createLayoutConfig, verifyLayoutConfig |
字段詳細(xì)信息
INDICATOR_BOTTOM_LINE
public static final int INDICATOR_BOTTOM_LINE
表示選擇指示器是選項(xiàng)卡的底線。
Since:
3
INDICATOR_INVISIBLE
public static final int INDICATOR_INVISIBLE
表示選擇指示器已隱藏。
Since:
3
INDICATOR_LEFT_LINE
public static final int INDICATOR_LEFT_LINE
表示選擇指示器是選項(xiàng)卡左側(cè)的垂直線。
Since:
3
INDICATOR_OVAL
public static final int INDICATOR_OVAL
指示選擇指示器是選項(xiàng)卡上的橢圓形背景。
Since:
3
構(gòu)造函數(shù)詳細(xì)信息
TabList
public TabList(Context context)
默認(rèn)構(gòu)造函數(shù)用于使用默認(rèn)屬性集和樣式創(chuàng)建 TabList 實(shí)例。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| context | 指示應(yīng)用程序上下文。 |
TabList
public TabList(Context context, AttrSet attrSet)
用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 TabList 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| context | 指示應(yīng)用程序上下文。 |
| attrSet | 指示要使用的屬性集。 |
TabList
public TabList(Context context, AttrSet attrSet, String styleName)
用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 TabList 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| context | 指示應(yīng)用程序上下文。 |
| attrSet | 指示要使用的屬性集。 |
| styleName | 指示要使用的樣式名稱。 |
方法詳情
addTab
public void addTab(TabList.Tab tab)
在當(dāng)前布局的末尾添加一個(gè)選項(xiàng)卡。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| tab | 指示要添加的選項(xiàng)卡。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果選項(xiàng)卡值為空,則引發(fā)此異常。 |
Since:
3
addTab
public void addTab(TabList.Tab tab, int pos)
將選項(xiàng)卡添加到當(dāng)前布局中的指定位置。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| tab | 指示要添加到指定位置的選項(xiàng)卡。 |
| pos | 表示添加tab的位置,必須是小于tab總數(shù)的非負(fù)整數(shù)。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果選項(xiàng)卡值為空,則引發(fā)此異常。 |
| IllegalArgumentException | 如果 pos 值小于 0,則拋出此異常。 |
Since:
3
addTab
public void addTab(TabList.Tab tab, boolean selected)
在當(dāng)前布局的末尾添加一個(gè)選項(xiàng)卡并指定它是否被選中。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| tab | 指示要添加的選項(xiàng)卡。 |
| selected | 指示選項(xiàng)卡是否被選中。 true 表示選項(xiàng)卡被選中; false 表示其他情況。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果選項(xiàng)卡值為空,則引發(fā)此異常。 |
Since:
3
addTab
public void addTab(TabList.Tab tab, int pos, boolean selected)
將選項(xiàng)卡添加到當(dāng)前布局中的某個(gè)位置并指定它是否被選中。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| tab | 指示要添加的選項(xiàng)卡。 |
| pos | 指示添加選項(xiàng)卡的位置。 |
| selected | 指示選項(xiàng)卡是否被選中。 true 表示該選項(xiàng)卡被選中; 而 false 則相反。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果選項(xiàng)卡值為空,則引發(fā)此異常。 |
| IllegalArgumentException | 如果 pos 值小于 0,則拋出此異常。 |
Since:
3
removeTab
public void removeTab(TabList.Tab tab)
刪除選項(xiàng)卡。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| tab | 指示要?jiǎng)h除的選項(xiàng)卡。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果參數(shù)值為 null,則引發(fā)此異常。 |
Since:
3
removeTab
public void removeTab(int pos)
從指定位置刪除選項(xiàng)卡。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| pos | 指示要?jiǎng)h除的選項(xiàng)卡的位置。 該值必須是小于選項(xiàng)卡總數(shù)的非負(fù)整數(shù)。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果 pos 值小于 0 或此位置上沒有制表符,則拋出此異常。 |
Since:
3
removeAllComponents
public void removeAllComponents()
從當(dāng)前組件中刪除所有選項(xiàng)卡。
覆蓋:
ComponentContainer 類中的 removeAllComponents
getTabAt
public TabList.Tab getTabAt(int pos)
獲取指定位置的選項(xiàng)卡。
此方法返回指定位置的選項(xiàng)卡,如果位置無效,則返回空指針。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| pos | 指示選項(xiàng)卡的位置。 該值必須是非負(fù)整數(shù)。 |
返回:
返回指定位置的選項(xiàng)卡。
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果參數(shù)值小于 0,則拋出此異常。 |
Since:
3
selectTabAt
public void selectTabAt(int pos)
選擇表中指定位置的選項(xiàng)卡。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| pos | 表示表格中的指定位置。 該值必須是非負(fù)整數(shù)。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果參數(shù)值小于 0 或此位置上沒有制表符,則引發(fā)此異常。 |
Since:
4
selectTab
public void selectTab(TabList.Tab tab)
選擇一個(gè)選項(xiàng)卡。
如果之前選擇的選項(xiàng)卡屬于當(dāng)前組件,則會自動取消選擇它。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| tab | 指示要選擇的選項(xiàng)卡。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果參數(shù)值為 null,則引發(fā)此異常。 |
Since:
3
getSelectedTab
public TabList.Tab getSelectedTab()
獲取組件中選定的選項(xiàng)卡。
返回:
返回選定的選項(xiàng)卡或 null 未選擇選項(xiàng)卡。
getSelectedTabIndex
public int getSelectedTabIndex()
獲取選定選項(xiàng)卡在組件中的位置。
返回:
返回選定選項(xiàng)卡的位置。 該值必須是非負(fù)整數(shù)。
Since:
4
getTabCount
public int getTabCount()
獲取組件中的選項(xiàng)卡數(shù)。
返回:
返回組件中選項(xiàng)卡的數(shù)量,為非負(fù)整數(shù)。
setTabTextColors
public void setTabTextColors(int normal, int selected)
設(shè)置選定和取消選定選項(xiàng)卡的文本顏色。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| normal | 指示取消選擇的選項(xiàng)卡的文本顏色。 |
| selected | 指示選定選項(xiàng)卡的文本顏色。 |
Since:
3
getNormalTabTextColor
public int getNormalTabTextColor()
獲取該選項(xiàng)卡處于正常狀態(tài)時(shí)的文本顏色。
返回:
返回一個(gè)非負(fù)整數(shù),表示選項(xiàng)卡的文本顏色值。
Since:
5
getSelectedTabTextColor
public int getSelectedTabTextColor()
獲取該選項(xiàng)卡被選中時(shí)的文本顏色。
返回:
返回一個(gè)非負(fù)整數(shù),表示選項(xiàng)卡的文本顏色值。
Since:
5
setTabTextSize
public void setTabTextSize(int size)
設(shè)置組件中所有選項(xiàng)卡的文本大小。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| size | 指示為所有選項(xiàng)卡設(shè)置的文本大小。 該值必須是正整數(shù)。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果參數(shù)值小于 0,則拋出此異常 |
Since:
3
getTabTextSize
public int getTabTextSize()
獲取表格的文本大小。
返回:
返回表示文本大小的非負(fù)整數(shù),以像素為單位。
Since:
4
getTabTextAlignment
public int getTabTextAlignment()
獲取表格的文本對齊方式。
返回:
返回表示文本對齊模式的非負(fù)整數(shù)。
- TextAlignment.LEFT:左對齊
- TextAlignment.RIGHT:右對齊
- TextAlignment.HORIZONTAL_CENTER:水平居中
- TextAlignment.TOP:頂部對齊
- TextAlignment.VERTICAL_CENTER:垂直居中
- TextAlignment.BOTTOM:底部對齊
- TextAlignment.CENTER:水平和垂直居中
- TextAlignment.START:開始對齊
- TextAlignment.END:結(jié)束對齊
Since:
4
getTabLength
public int getTabLength()
獲取表中所有標(biāo)簽的長度,為非負(fù)整數(shù)。
返回:
返回長度。
Since:
4
getTabMargin
public int getTabMargin()
獲取表格中兩個(gè)相鄰選項(xiàng)卡之間的邊距(以像素為單位)。
返回:
返回表示邊距的非負(fù)整數(shù),以像素為單位。
Since:
4
setTabTextAlignment
public void setTabTextAlignment(int alignment)
設(shè)置組件中所有選項(xiàng)卡的文本對齊方式。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| alignment | 表示標(biāo)簽的文本對齊方式。TextAlignment.LEFT:左對齊;TextAlignment.RIGHT:右對齊;TextAlignment.HORIZONTAL_CENTER:水平居中;TextAlignment.TOP:上對齊;TextAlignment.VERTICAL_CENTER:垂直居中;TextAlignment.BOTTOM:下對齊;TextAlignment .CENTER:水平和垂直居中;TextAlignment.START:開始對齊;TextAlignment.END:結(jié)束對齊。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果參數(shù)值與 TextAlignment 不對應(yīng),則引發(fā)異常。 |
setTabLength
public void setTabLength(int length)
設(shè)置布局中所有選項(xiàng)卡的寬度或高度。
選項(xiàng)卡寬度在水平布局中設(shè)置,而選項(xiàng)卡高度在垂直布局中設(shè)置。 該值必須是非負(fù)整數(shù)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| length | 指示選項(xiàng)卡的寬度或高度。 |
Since:
3
setTabMargin
public void setTabMargin(int margin)
設(shè)置組件中兩個(gè)選項(xiàng)卡之間的邊距。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| margin | 指示兩個(gè)選項(xiàng)卡之間的邊距。 該值必須是非負(fù)整數(shù)。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果參數(shù)值小于 0,則拋出此異常。 |
Since:
3
setFixedMode
public void setFixedMode(boolean isFixed)
設(shè)置是否修復(fù)所有選項(xiàng)卡并同時(shí)顯示它們。
如果禁用固定模式,則布局的寬度或高度等于其中所有選項(xiàng)卡的總寬度或高度。 如果啟用了固定模式,則布局的寬度或高度是固定的,并且其中的每個(gè)選項(xiàng)卡具有相同的寬度或高度。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| isFixed | 指示選項(xiàng)卡是否在布局中固定。 true 表示所有選項(xiàng)卡都是固定的,false 表示相反。 |
Since:
3
isFixedMode
public boolean isFixedMode()
獲取是否開啟固定模式。 默認(rèn)情況下,固定模式被禁用。
返回:
如果啟用了固定模式,則返回 true; 否則返回 false。
Since:
3
setSelectedTabIndicatorColor
public void setSelectedTabIndicatorColor(int color)
設(shè)置選定選項(xiàng)卡的顏色。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| color | 表示選中選項(xiàng)卡的顏色,可以是自定義顏色,也可以是Color的常量指定。 |
getSelectedTabIndicatorColor
public int getSelectedTabIndicatorColor()
獲取所選標(biāo)簽指示器的顏色。
返回:
返回選定選項(xiàng)卡指示器的顏色。
Since:
3
setSelectedTabIndicatorHeight
public void setSelectedTabIndicatorHeight(int height)
設(shè)置選定選項(xiàng)卡的高度。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| height | 指示選定選項(xiàng)卡的高度。 該值必須是非負(fù)整數(shù)。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果參數(shù)值小于 0,則拋出此異常。 |
Since:
3
getSelectedTabIndicatorHeight
public int getSelectedTabIndicatorHeight()
獲取所選標(biāo)簽指示器的高度。
返回:
返回選定選項(xiàng)卡指示器的高度。
Since:
3
setOrientation
public void setOrientation(int orientation)
設(shè)置布局方向。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| orientation | 表示布局方向,可以是Component.HORIZONTAL或Component.VERTICAL。 |
Since:
3
getOrientation
public int getOrientation()
獲取布局方向。
返回:
返回布局方向。
Since:
3
setIndicatorType
public void setIndicatorType(int type)
設(shè)置選項(xiàng)卡指示器類型。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| type | 指示標(biāo)簽指示器類型,可以是 INDICATOR_INVISIBLE、INDICATOR_BOTTOM_LINE、INDICATOR_LEFT_LINE 或 INDICATOR_OVAL。 |
Since:
3
getIndicatorType
public int getIndicatorType()
獲取選項(xiàng)卡指示器類型。
返回:
返回選項(xiàng)卡指示器類型,可以是 INDICATOR_INVISIBLE、INDICATOR_BOTTOM_LINE、INDICATOR_LEFT_LINE 或 INDICATOR_OVAL。
Since:
3
addTabSelectedListener
public void addTabSelectedListener(TabList.TabSelectedListener listener)
將選定的偵聽器添加到列表中的選項(xiàng)卡。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| listener | 表示監(jiān)聽器。 |
Since:
3
removeTabSelectedListener
public void removeTabSelectedListener(TabList.TabSelectedListener listener)
從布局中的選項(xiàng)卡中刪除選定事件的偵聽器。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| listener | 指示要?jiǎng)h除的偵聽器。 |
Since:
3
新聞名稱:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSTabList
鏈接URL:http://www.dlmjj.cn/article/dpghhhs.html


咨詢
建站咨詢
