W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎勵
java.lang.Object
|---ohos.agp.components.Component
|---|---ohos.agp.components.ProgressBar
public class ProgressBar
extends Component
提供用于指示 UI 上操作的進(jìn)度的元素。
進(jìn)度條支持確定類型和不確定類型。 進(jìn)度條顯示在 UI 或通知中,不會打擾用戶。
不確定的進(jìn)展
當(dāng)操作所需的時間不確定時,使用不確定的進(jìn)度條。
確定進(jìn)度
當(dāng)您需要顯示操作的具體進(jìn)度量時,使用確定進(jìn)度條。 您可以使用 setProgressValue(int) 函數(shù)來更新當(dāng)前進(jìn)度。 默認(rèn)情況下,當(dāng)進(jìn)度條上顯示的進(jìn)度值達(dá)到 100 時,操作完成。
Since:
1
修飾符和類型 | 類 | 描述 |
---|---|---|
static interface | ProgressBar.BarObserver | 提供一個文本觀察器來監(jiān)聽組件中進(jì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.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ù) | 描述 |
---|---|
ProgressBar(Context context) | 用于使用默認(rèn)屬性集和樣式創(chuàng)建 ProgressBar 實(shí)例的默認(rèn)構(gòu)造函數(shù)。 |
ProgressBar(Context context, AttrSet attrSet) | 用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 ProgressBar 實(shí)例的構(gòu)造函數(shù)。 |
ProgressBar(Context context, AttrSet attrSet, String styleName) | 用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 ProgressBar 實(shí)例的構(gòu)造函數(shù)。 |
修飾符和類型 | 方法 | 描述 |
---|---|---|
void | addBarObserver(ProgressBar.BarObserver observer) | 添加一個 BarObserver 來監(jiān)控這個進(jìn)度條的變化。 |
void | enableDividerLines(boolean enable) | 設(shè)置進(jìn)度條的分隔符狀態(tài)。 |
Element | getBackgroundInstructElement() | 獲取用作進(jìn)度條背景的 Element 對象。 |
Color | getDividerLineColor() | 獲取分隔線顏色。 |
int | getDividerLinesNumber() | 獲取此進(jìn)度條的分隔線數(shù)。 |
int | getDividerLineThickness() | 獲取分隔線粗細(xì)。 |
Element | getInfiniteModeElement() | 獲取用于繪制不確定進(jìn)度條的元素對象。 |
int | getMax() | 獲取確定進(jìn)度條的上限。 |
int | getMaxHeight() | 獲取進(jìn)度條的最大高度。 |
int | getMaxWidth() | 獲取進(jìn)度條的最大寬度。 |
int | getMin() | 獲取確定進(jìn)度條的下限。 |
int | getOrientation() | 獲取進(jìn)度條方向。 |
int | getProgress() | 獲取進(jìn)度條的當(dāng)前進(jìn)度值。 |
Color | getProgressColor() | 獲取此進(jìn)度條的顏色。 |
int[] | getProgressColors() | 獲取用于繪制此進(jìn)度條的 ShapeElement 對象的填充顏色。 |
Element | getProgressElement() | 獲取用作進(jìn)度條的 Element 對象。 |
String | getProgressHintText() | 獲取進(jìn)度條上的提示文本。 |
int | getProgressHintTextAlignment() | 獲取進(jìn)度條上的提示文本對齊方式。 |
Color | getProgressHintTextColor() | 獲取進(jìn)度條上的提示文本顏色。 |
int | getProgressHintTextSize() | 獲取此進(jìn)度條上提示文本的大小。 |
int | getProgressWidth() | 獲取此進(jìn)度條的最大寬度。 |
int | getStep() | 獲取進(jìn)度條的進(jìn)度步驟。 |
Element | getViceProgressElement() | 獲取用作副進(jìn)度條的 Element 對象。 |
int | getViceProgressValue() | 獲取進(jìn)度條的二級進(jìn)度值。 |
boolean | isDividerLinesEnabled() | 檢查是否啟用了分隔線。 |
boolean | isIndeterminate() | 檢查是否啟用了不確定模式。 |
boolean | isInfiniteMode() | 檢查是否為進(jìn)度條啟用了不確定模式。 |
void | removeBarObserver(ProgressBar.BarObserver observer) | 移除此進(jìn)度條的 BarObserver。 |
void | setDividerLineColor(Color color) | 設(shè)置分隔線顏色。 |
void | setDividerLinesNumber(int number) | 設(shè)置此進(jìn)度條的分隔線數(shù)量。 |
void | setDividerLineThickness(int thickness) | 設(shè)置分隔線粗細(xì)。 |
void | setIndeterminate(boolean indeterminate) | 設(shè)置是否為進(jìn)度條啟用不確定模式。 |
void | setInfiniteModeElement(Element element) | 設(shè)置用于繪制不確定進(jìn)度條的元素對象。 |
void | setMaxHeight(int maxHeight) | 設(shè)置進(jìn)度條的最大高度。 |
void | setMaxValue(int max) | 設(shè)置進(jìn)度條的上限。 |
void | setMaxWidth(int maxWidth) | 設(shè)置進(jìn)度條的最大寬度。 |
void | setMinValue(int min) | 設(shè)置進(jìn)度條的下限。 |
void | setOrientation(int orientation) | 設(shè)置進(jìn)度條方向。 |
void | setProgressBackgroundElement(Element element) | 將 Element 對象設(shè)置為進(jìn)度條的背景。 |
void | setProgressColor(Color color) | 設(shè)置此進(jìn)度條的顏色。 |
void | setProgressColors(int[] colors) | 設(shè)置此進(jìn)度條的漸變效果的顏色。 |
void | setProgressElement(Element element) | 將 Element 對象設(shè)置為進(jìn)度條。 |
void | setProgressHintText(String text) | 設(shè)置進(jìn)度條的提示文本。 |
void | setProgressHintTextAlignment(int alignment) | 在進(jìn)度條上設(shè)置提示文本對齊模式。 |
void | setProgressHintTextColor(Color color) | 在進(jìn)度條上設(shè)置提示文本顏色。 |
void | setProgressHintTextSize(int size) | 設(shè)置此進(jìn)度條上提示文本的大小。 |
void | setProgressValue(int progress) | 設(shè)置進(jìn)度條的當(dāng)前進(jìn)度。 |
void | setProgressWidth(int progressWidth) | 設(shè)置此進(jìn)度條的最大寬度。 |
void | setStep(int step) | 設(shè)置進(jìn)度步驟。 |
void | setViceProgress(int progress) | 設(shè)置進(jìn)度條的次要進(jìn)度值。 |
void | setViceProgressElement(Element element) | 將 Element 對象設(shè)置為副進(jìn)度條。 |
從類 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 |
從類 java.lang.Object 繼承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
public ProgressBar(Context context)
用于使用默認(rèn)屬性集和樣式創(chuàng)建 ProgressBar 實(shí)例的默認(rèn)構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
context | 指示應(yīng)用程序上下文。 |
public ProgressBar(Context context, AttrSet attrSet)
用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 ProgressBar 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
context | 指示應(yīng)用程序上下文。 |
attrSet | 指示要使用的屬性集。 |
public ProgressBar(Context context, AttrSet attrSet, String styleName)
用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 ProgressBar 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
context | 指示應(yīng)用程序上下文。 |
attrSet | 指示要使用的屬性集。 |
styleName | 指示要使用的樣式名稱。 |
public void setOrientation(int orientation)
設(shè)置進(jìn)度條方向。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
orientation | 指示進(jìn)度條方向,可以是 Component.HORIZONTAL 或 Component.VERTICAL。 |
Since:
2
public int getOrientation()
獲取進(jìn)度條方向。
返回:
返回進(jìn)度條方向,可以是 Component.HORIZONTAL 或 Component.VERTICAL。
Since:
2
public void setMinValue(int min)
設(shè)置進(jìn)度條的下限。
此方法在實(shí)際進(jìn)度小于下限時顯示進(jìn)度條的下限。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
min | 指示進(jìn)度條的下限。 |
Since:
4
public void setMaxValue(int max)
設(shè)置進(jìn)度條的上限。
當(dāng)實(shí)際進(jìn)度大于上限時,該方法在進(jìn)度條上顯示上限。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
max | 表示進(jìn)度條的上限。 |
Since:
4
public void setProgressValue(int progress)
設(shè)置進(jìn)度條的當(dāng)前進(jìn)度。
此方法立即更新進(jìn)度指示器。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
progress | 指示 getMin() 和 getMax() 之間的進(jìn)度值。 |
Since:
4
public void setViceProgress(int progress)
設(shè)置進(jìn)度條的次要進(jìn)度值。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
progress | 表示二級進(jìn)度值,必須在getMin()和getMax()的范圍內(nèi)。 |
Since:
4
public void setStep(int step)
設(shè)置進(jìn)度步驟。
此方法設(shè)置增加或減少進(jìn)度值的步驟。 默認(rèn)值為 1。如果步長為 10,則進(jìn)度值為 10 的倍數(shù)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
step | 指示進(jìn)度步驟。 |
Since:
1
public void setIndeterminate(boolean indeterminate)
設(shè)置是否為進(jìn)度條啟用不確定模式。
如果禁用不確定模式,將顯示進(jìn)度值。 如果啟用了不確定模式,則會顯示無限循環(huán)的動畫。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
indeterminate | 指示是否為進(jìn)度條啟用不確定模式。 true 表示啟用不確定模式; false 表示其他情況。 |
Since:
1
public boolean isIndeterminate()
檢查是否啟用了不確定模式。
返回:
如果啟用了不確定模式,則返回 true; 否則返回 false。
Since:
3
public void setInfiniteModeElement(Element element)
設(shè)置用于繪制不確定進(jìn)度條的元素對象。
元素對象圍繞其中心重復(fù)順時針旋轉(zhuǎn)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
element | 表示元素對象。 |
Since:
4
public void setMaxWidth(int maxWidth)
設(shè)置進(jìn)度條的最大寬度。
如果父布局提供的寬度大于最大寬度,則使用最大寬度進(jìn)行繪制。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
maxWidth | 指示進(jìn)度條的最大寬度。 |
Since:
1
public void setMaxHeight(int maxHeight)
設(shè)置進(jìn)度條的最大高度。
如果父布局提供的高度大于最大高度,則使用最大高度繪制進(jìn)度條。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
maxHeight | 表示最大高度。 |
Since:
1
public Element getInfiniteModeElement()
獲取用于繪制不確定進(jìn)度條的元素對象。
元素對象圍繞其中心重復(fù)順時針旋轉(zhuǎn)。
返回:
返回元素對象。
Since:
4
public int getMin()
獲取確定進(jìn)度條的下限。
默認(rèn)情況下,下限為 0。
返回:
返回確定進(jìn)度條的下限,為 0 或正整數(shù)。
Since:
1
public int getMax()
獲取確定進(jìn)度條的上限。
默認(rèn)情況下,上限為 100。
返回:
返回確定進(jìn)度條的上限,為正整數(shù)。
Since:
1
public int getProgress()
獲取進(jìn)度條的當(dāng)前進(jìn)度值。
該方法獲取確定進(jìn)度條的當(dāng)前進(jìn)度值。 默認(rèn)情況下,初始值設(shè)置為下限。
返回:
返回進(jìn)度值,它是一個整數(shù)。
Since:
1
public int getViceProgressValue()
獲取進(jìn)度條的二級進(jìn)度值。
返回:
返回進(jìn)度條的二級進(jìn)度值。
Since:
4
public int getStep()
獲取進(jìn)度條的進(jìn)度步驟。
進(jìn)度值只能是進(jìn)度步長的倍數(shù)。 進(jìn)度步默認(rèn)設(shè)置為 1。
返回:
返回進(jìn)度條的進(jìn)度步長,為正整數(shù)。
Since:
1
public boolean isInfiniteMode()
檢查是否為進(jìn)度條啟用了不確定模式。
確定模式是指在進(jìn)度條上顯示一定的進(jìn)度值來顯示當(dāng)前的進(jìn)度。 不確定模式表示進(jìn)度值不可用,并顯示一個圍繞其中心順時針重復(fù)旋轉(zhuǎn)的元素對象,以顯示操作的進(jìn)行狀態(tài)。
返回:
如果為進(jìn)度條啟用了不確定模式,則返回 true; 否則返回 false。
Since:
4
public int getMaxWidth()
獲取進(jìn)度條的最大寬度。
此方法將進(jìn)度條的最大寬度與父組件提供的最大寬度進(jìn)行比較。 如果父組件提供的寬度超過最大寬度,進(jìn)度條將使用其最大寬度繪制。
返回:
返回進(jìn)度條的最大寬度。
Since:
1
public int getMaxHeight()
獲取進(jìn)度條的最大高度。
此方法將進(jìn)度條的最大高度與父組件提供的高度進(jìn)行比較。 如果父組件提供的高度超過最大高度,進(jìn)度條將使用其最大高度繪制。
返回:
返回進(jìn)度條的最大高度。
Since:
1
public void setProgressBackgroundElement(Element element)
將 Element 對象設(shè)置為進(jìn)度條的背景。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
element | 指示用作進(jìn)度條背景的 Element 對象。 |
Since:
2
public void setProgressElement(Element element)
將 Element 對象設(shè)置為進(jìn)度條。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
element | 指示用作進(jìn)度條的 Element 對象。 |
Since:
2
public void setViceProgressElement(Element element)
將 Element 對象設(shè)置為副進(jìn)度條。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
element | 指示用作副進(jìn)度條的 Element 對象。 |
Since:
4
public Element getBackgroundInstructElement()
獲取用作進(jìn)度條背景的 Element 對象。
返回:
返回用作進(jìn)度條背景的 Element 對象。
Since:
4
public Element getProgressElement()
獲取用作進(jìn)度條的 Element 對象。
返回:
返回用作進(jìn)度條的 Element 對象。
Since:
2
public Element getViceProgressElement()
獲取用作副進(jìn)度條的 Element 對象。
返回:
返回用作副進(jìn)度條的 Element 對象。
Since:
4
public String getProgressHintText()
獲取進(jìn)度條上的提示文本。
返回:
返回進(jìn)度條上的提示文本。
Since:
2
public void setProgressHintText(String text)
設(shè)置進(jìn)度條的提示文本。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
text | 表示進(jìn)度條的提示文字。 |
Since:
2
public void setProgressHintTextSize(int size)
設(shè)置此進(jìn)度條上提示文本的大小。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
size | 指示要設(shè)置的大小,以像素為單位。 |
Since:
4
public int getProgressHintTextSize()
獲取此進(jìn)度條上提示文本的大小。
返回:
返回提示文本大小,以像素為單位。
Since:
4
public void setProgressHintTextColor(Color color)
在進(jìn)度條上設(shè)置提示文本顏色。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
color | 指示提示文本顏色。 |
Since:
2
public Color getProgressHintTextColor()
獲取進(jìn)度條上的提示文本顏色。
返回:
返回提示文本顏色。
Since:
2
public void setProgressHintTextAlignment(int alignment)
在進(jìn)度條上設(shè)置提示文本對齊模式。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
alignment | 指示提示文本對齊方式。 |
Since:
2
public int getProgressHintTextAlignment()
獲取進(jìn)度條上的提示文本對齊方式。
返回:
返回提示文本對齊模式。
Since:
2
public void enableDividerLines(boolean enable)
設(shè)置進(jìn)度條的分隔符狀態(tài)。
此方法啟用或禁用進(jìn)度條的分隔線。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
enable | 指示是否啟用分隔符。 enable 表示啟用分頻器; disable 表示禁用。 |
Since:
3
public boolean isDividerLinesEnabled()
檢查是否啟用了分隔線。
返回:
如果啟用了分隔線,則返回 true; 否則返回 false。
Since:
3
public void setDividerLinesNumber(int number)
設(shè)置此進(jìn)度條的分隔線數(shù)量。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
number | 指示要設(shè)置的分隔符數(shù)量。 |
Since:
3
public int getDividerLinesNumber()
獲取此進(jìn)度條的分隔線數(shù)。
返回:
返回分頻器的數(shù)量。
Since:
3
public void setDividerLineThickness(int thickness)
設(shè)置分隔線粗細(xì)。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
thickness | 指示分隔線粗細(xì)。 |
Since:
3
public int getDividerLineThickness()
獲取分隔線粗細(xì)。
返回:
返回分隔線粗細(xì)。
Since:
3
public void setDividerLineColor(Color color)
設(shè)置分隔線顏色。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
color | Indicates the divider line color. |
Since:
3
public Color getDividerLineColor()
獲取分隔線顏色。
返回:
返回分隔線顏色。
Since:
3
public void setProgressWidth(int progressWidth)
設(shè)置此進(jìn)度條的最大寬度。
將使用其寬度繪制進(jìn)度條。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
progressWidth | 指示要設(shè)置的最大寬度。 |
Since:
3
public int getProgressWidth()
獲取此進(jìn)度條的最大寬度。
將使用其寬度繪制進(jìn)度條。
返回:
返回最大寬度。
Since:
3
public void setProgressColor(Color color)
設(shè)置此進(jìn)度條的顏色。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
color | 指示要設(shè)置的顏色。 |
Since:
3
public Color getProgressColor()
獲取此進(jìn)度條的顏色。
返回:
返回顏色。
Since:
3
public void setProgressColors(int[] colors)
設(shè)置此進(jìn)度條的漸變效果的顏色。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
colors | 指示要設(shè)置的顏色。 |
Since:
3
public int[] getProgressColors()
獲取用于繪制此進(jìn)度條的 ShapeElement 對象的填充顏色。
返回:
如果可用,則返回填充顏色數(shù)組; 如果使用純色,則返回一個只有一個元素的數(shù)組。
Since:
3
public void addBarObserver(ProgressBar.BarObserver observer)
添加一個 BarObserver 來監(jiān)控這個進(jìn)度條的變化。
在使用 BarObserver 之前,您必須實(shí)現(xiàn) BarObserver#onBarChanged。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
observer | 指示要添加的條形觀察者。 |
Since:
4
public void removeBarObserver(ProgressBar.BarObserver observer)
移除此進(jìn)度條的 BarObserver。
參數(shù):
參數(shù)名稱 | 參數(shù)描述 |
---|---|
observer | 指示要刪除的條形觀察者。 |
Since:
4
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: