鴻蒙OS RoundProgressBar

2022-09-29 10:33 更新

RoundProgressBar

java.lang.Object

|---ohos.agp.components.Component

|---|---ohos.agp.components.ProgressBar

|---|---|---ohos.agp.components.RoundProgressBar

public class RoundProgressBar
extends ProgressBar

表示 UI 上的圓形進(jìn)度條。

圓形進(jìn)度條可以是確定的或不確定的類(lèi)型。它顯示在 UI 或通知中,而不會(huì)中斷用戶操作。此類(lèi)繼承自 ProgressBar 并支持自定義元素對(duì)象和背景以顯示不確定或確定的進(jìn)度。有關(guān)詳細(xì)信息,請(qǐng)參閱 ProgressBar.setInfiniteModeElement(ohos.agp.components.element.Element)、ProgressBar.setProgressBackgroundElement(ohos.agp.components.element.Element) 和 ProgressBar.setProgressElement(ohos.agp.components.element.Element)。上述方法通常與 ShapeElement、ShapeElement#ARC 和 ShapeElement#OVAL 一起使用。如果設(shè)置了其他形狀,結(jié)果可能無(wú)法預(yù)測(cè)。如果您需要將默認(rèn)元素對(duì)象替換為自定義元素對(duì)象,請(qǐng)注意 ShapeElement#setShape(int)) 中的參數(shù)。

不確定的回合進(jìn)度

當(dāng)操作所需的時(shí)間不確定時(shí),使用不確定的圓形進(jìn)度條。

確定回合進(jìn)度

當(dāng)需要顯示某個(gè)操作的具體進(jìn)度值時(shí),使用確定的圓形進(jìn)度條。您可以使用 ProgressBar.setProgressValue(int) 來(lái)更新當(dāng)前進(jìn)度。默認(rèn)情況下,當(dāng)圓形進(jìn)度條上顯示的進(jìn)度值達(dá)到 100 時(shí),操作完成。

Since:

3

嵌套類(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.ProgressBar 繼承的嵌套類(lèi)/接口
ProgressBar.BarObserver

字段摘要

從類(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

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

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

方法總結(jié)

修飾符和類(lèi)型 方法 描述
float getMaxAngle() 獲取本輪進(jìn)度條的最大掃角。
float getStartAngle() 獲取本輪進(jìn)度條的起始角度。
void setMaxAngle(float maxAngle) 設(shè)置此圓形進(jìn)度條的最大掃描角度。
void setStartAngle(float startAngle) 設(shè)置此圓形進(jìn)度條的起始角度。
從類(lèi) ohos.agp.components.Component 繼承的方法
addDrawTask, addDrawTask, addScrolledListener, announceAccessibility, arrange, bindCornerMark, callOnClick, canScroll, clearFocus, createAnimatorProperty, disableFadeEffect, dispatchRestoreState, dispatchSaveState, draw, enableCornerMark, enableFadeEffect, enableSaveState, enableScrollBar, estimateSize, executeDoubleClick, executeLongClick, findComponentById, findComponentHolderById, 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, informConfigurationChanged, invalidate, isBoundaryFadeEffectEnable, isBoundToWindow, isClickable, isClipToContourEnabled, isComponentDisplayed, isEnabled, isFadeEffected, isFocusable, isFocused, isIdentityMatrix, isLongClickOn, isPressed, isRtl, isSaveStateEnabled, isScrollbarFadingOn, isScrollBarOn, isScrollbarOverlapEnabled, isSelected, isSoundEnable, isTouchFocusable, isVibrationEffectEnabled, notifyAccessibility, onAttributeConfigChanged, onDrag, 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) java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
從類(lèi) ohos.agp.components.ProgressBar 繼承的方法
addBarObserver, enableDividerLines, getBackgroundInstructElement, getDividerLineColor, getDividerLinesNumber, getDividerLineThickness, getInfiniteModeElement, getMax, getMaxHeight, getMaxWidth, getMin, getOrientation, getProgress, getProgressColor, getProgressColors, getProgressElement, getProgressHintText, getProgressHintTextAlignment, getProgressHintTextColor, getProgressHintTextSize, getProgressWidth, getStep, getViceProgressElement, getViceProgressValue, isDividerLinesEnabled, isIndeterminate, isInfiniteMode, removeBarObserver, setDividerLineColor, setDividerLinesNumber, setDividerLineThickness, setIndeterminate, setInfiniteModeElement, setMaxHeight, setMaxValue, setMaxWidth, setMinValue, setOrientation, setProgressBackgroundElement, setProgressColor, setProgressColors, setProgressElement, setProgressHintText, setProgressHintTextAlignment, setProgressHintTextColor, setProgressHintTextSize, setProgressValue, setProgressWidth, setStep, setViceProgress, setViceProgressElement

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

RoundProgressBar

public RoundProgressBar(Context context)

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

參數(shù):

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

RoundProgressBar

public RoundProgressBar(Context context, AttrSet attrSet)

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

參數(shù):

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

RoundProgressBar

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

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

參數(shù):

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

方法詳情

setStartAngle

public void setStartAngle(float startAngle)

設(shè)置此圓形進(jìn)度條的起始角度。 此方法僅適用于確定的進(jìn)度條。

參數(shù):

參數(shù)名稱 參數(shù)描述
startAngle 指示要設(shè)置的起始角度。 取值范圍為 0 到 360 度。

Since:

3

getStartAngle

public float getStartAngle()

獲取本輪進(jìn)度條的起始角度。 此方法僅適用于確定的進(jìn)度條。

返回:

返回起始角度。

Since:

3

setMaxAngle

public void setMaxAngle(float maxAngle)

設(shè)置此圓形進(jìn)度條的最大掃描角度。 此方法僅適用于確定的進(jìn)度條。

參數(shù):

參數(shù)名稱 參數(shù)描述
maxAngle 指示要設(shè)置的最大掃掠角。 取值范圍為 0 到 360 度。

Since:

3

getMaxAngle

public float getMaxAngle()

獲取本輪進(jìn)度條的最大掃角。 默認(rèn)情況下,它是 360 度。 此方法僅適用于確定的進(jìn)度條。

返回:

返回最大掃角。

Since:

3

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

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)