W3Cschool
恭喜您成為首批注冊(cè)用戶(hù)
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
java.lang.Object
|---ohos.agp.components.Component
|---|---ohos.agp.components.ComponentContainer
|---|---|---ohos.agp.components.DirectionalLayout
|---|---|---|---ohos.agp.components.RadioContainer
public class RadioContainer
extends DirectionalLayout
創(chuàng)建一組表示一系列獨(dú)占選項(xiàng)的單選按鈕。
選擇單選組中的一個(gè)單選按鈕將自動(dòng)取消選擇同一組中的其他單選按鈕。 默認(rèn)情況下,取消選擇組中的所有單選按鈕。 無(wú)法取消選擇已選擇的單選按鈕,但可以清除單選組以取消該單選按鈕的選中狀態(tài)。
Since:
3
修飾符和類(lèi)型 | 類(lèi) | 描述 |
---|---|---|
static interface | RadioContainer.CheckedStateChangedListener | 提供回調(diào)方法來(lái)處理單選按鈕容器的更改事件。 |
從類(lèi) ohos.agp.components.Component 繼承的嵌套類(lèi)/接口 |
---|
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 |
從類(lèi) ohos.agp.components.ComponentContainer 繼承的嵌套類(lèi)/接口 |
---|
ComponentContainer.ArrangeListener |
從類(lèi) ohos.agp.components.DirectionalLayout 繼承的嵌套類(lèi)/接口 |
---|
DirectionalLayout.LayoutConfig |
修飾符和類(lèi)型 | 字段 | 描述 |
---|---|---|
static int | INVALID_ID | 表示無(wú)效的 id。 |
protected RadioContainer.CheckedStateChangedListener | mMarkListener | 指示單選組中單選按鈕更改事件的偵聽(tīng)器。 |
從類(lèi) 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 |
從類(lèi) ohos.agp.components.ComponentContainer 繼承的字段 |
---|
FOCUS_CHILDREN_FIRST, FOCUS_CHILDREN_HIDE, FOCUS_PARENT_FIRST, mArrangeListener |
構(gòu)造函數(shù) | 描述 |
---|---|
RadioContainer(Context context) | 用于使用默認(rèn)屬性集和樣式創(chuàng)建 RadioContainer 實(shí)例的默認(rèn)構(gòu)造函數(shù)。 |
RadioContainer(Context context, AttrSet attrSet) | 用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 RadioContainer 實(shí)例的構(gòu)造函數(shù)。 |
RadioContainer(Context context, AttrSet attrSet, String styleName) | 用于在 XML 文件解析后使用指定的屬性集和指定樣式創(chuàng)建 RadioContainer 實(shí)例的構(gòu)造函數(shù)。 |
修飾符和類(lèi)型 | 方法 | 描述 |
---|---|---|
void | cancelMarks() | 清除單選組中所有單選按鈕的選定狀態(tài)。 |
RadioContainer.CheckedStateChangedListener | getMarkChangedListener() | 獲取監(jiān)聽(tīng)此 RadioContainer 中單選按鈕更改事件的監(jiān)聽(tīng)器。 |
int | getMarkedButtonId() | 獲取單選組中選中單選按鈕的ID。 |
void | mark(int id) | 選擇其 ID 在參數(shù)中傳遞的單選按鈕。 |
void | setMarkChangedListener(RadioContainer.CheckedStateChangedListener listener) | 為單選容器中單選按鈕的更改事件設(shè)置偵聽(tīng)器。 |
從類(lèi) 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 |
從類(lèi) 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, removeAllComponents, removeComponent, removeComponentAt, removeComponentById, removeComponents, setArrangeListener, setAutoLayout, setAutoLayout, setClipToChildBoundsEnabled, setClipToPaddingBoundsEnabled, setComponentTransition, setFocusOrder, setLayoutManager, setTouchEventSplitable |
從接口 ohos.agp.components.ComponentParent 繼承的方法 |
---|
getComponentParent, postLayout |
從類(lèi) ohos.agp.components.DirectionalLayout 繼承的方法 |
---|
createLayoutConfig, getAlignment, getOrientation, getTotalWeight, isLayoutBaselined, setAlignment, setLayoutBaselined, setOrientation, setTotalWeight, verifyLayoutConfig |
從類(lèi) java.lang.Object 繼承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
public static final int INVALID_ID
表示無(wú)效的 id。
使用此值可清除單選組中所有單選按鈕的選定狀態(tài)。 見(jiàn)標(biāo)記(int)。
protected RadioContainer.CheckedStateChangedListener mMarkListener
指示單選組中單選按鈕更改事件的偵聽(tīng)器。
public RadioContainer(Context context)
用于使用默認(rèn)屬性集和樣式創(chuàng)建 RadioContainer 實(shí)例的默認(rèn)構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
context | 指示應(yīng)用程序上下文。 |
public RadioContainer(Context context, AttrSet attrSet)
用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 RadioContainer 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
context | 指示應(yīng)用程序上下文。 |
attrSet | 指示要使用的屬性集。 |
public RadioContainer(Context context, AttrSet attrSet, String styleName)
用于在 XML 文件解析后使用指定的屬性集和指定樣式創(chuàng)建 RadioContainer 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
context | 指示應(yīng)用程序上下文。 |
attrSet | 指示要使用的屬性集。 |
styleName | 指示要使用的樣式名稱(chēng)。 |
public void mark(int id)
選擇其 ID 在參數(shù)中傳遞的單選按鈕。
單選組中的每個(gè)單選按鈕都有一個(gè) ID,范圍從 0 到 n-1。 單選按鈕 ID 與 Component#getId() 中的不同。 如果單選按鈕 ID 為 INVALID_ID,則該組中所有單選按鈕的選中狀態(tài)都是清除的,相當(dāng)于 cancelMarks()。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
id | 指示要選擇的單選按鈕的 ID。 |
Throws:
Throw名稱(chēng) | Throw描述 |
---|---|
IllegalArgumentException | 如果參數(shù)值小于 INVALID_ID,則引發(fā)此異常。 |
Since:
4
public int getMarkedButtonId()
獲取單選組中選中單選按鈕的ID。
ID 范圍從 0 到 n-1。 如果取消選擇單選組中的所有按鈕,則 ID 為 INVALID_ID。
返回:
返回所選單選按鈕的 ID。
Since:
4
public void cancelMarks()
清除單選組中所有單選按鈕的選定狀態(tài)。
這樣,單選組中的所有按鈕都被取消選擇。
Since:
4
public void setMarkChangedListener(RadioContainer.CheckedStateChangedListener listener)
為單選容器中單選按鈕的更改事件設(shè)置偵聽(tīng)器。
當(dāng)單選按鈕的狀態(tài)從取消選中變?yōu)檫x中時(shí)使用此方法,反之亦然。 它通知單選按鈕的更改事件并調(diào)用 RadioContainer.CheckedStateChangedListener#onCheckedChanged(RadioContainer, int) 來(lái)處理更改事件。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
listener | 指示單選組中單選按鈕更改事件的偵聽(tīng)器。 |
Since:
4
public RadioContainer.CheckedStateChangedListener getMarkChangedListener()
獲取監(jiān)聽(tīng)此 RadioContainer 中單選按鈕更改事件的監(jiān)聽(tīng)器。
返回:
返回獲取的監(jiān)聽(tīng)器。
Since:
4
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話(huà):173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: