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

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

新聞中心

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

TimePicker

java.lang.Object

|---ohos.agp.components.Component

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

|---|---|---ohos.agp.components.StackLayout

|---|---|---|---ohos.agp.components.TimePicker

public class TimePicker
extends StackLayout

提供時間選擇器。

該類可用于倒計時時間選擇。 可選擇 24 小時或 12 小時時間模式。

Since:

1

嵌套類摘要

修飾符和類型描述
static classTimePicker.AmPmOrder定義表示上午的列的顯示格式。
static interfaceTimePicker.TimeChangedListener提供時間變化監(jiā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.ComponentContainer 繼承的嵌套類/接口
ComponentContainer.ArrangeListener
從類 ohos.agp.components.StackLayout 繼承的嵌套類/接口
StackLayout.LayoutConfig

字段摘要

修飾符和類型字段描述
protected TimePicker.TimeChangedListenermTimeChangedListener指示監(jiān)聽器 TimePicker.TimeChangedListener 監(jiān)聽所選時間的變化。
static floatROTATION_SENSITIVITY_DEFAULT指示 TimePicker 響應(yīng)旋轉(zhuǎn)表冠事件的默認旋轉(zhuǎn)靈敏度。
static floatROTATION_SENSITIVITY_HIGH表示 TimePicker 響應(yīng)旋轉(zhuǎn)表冠事件的高旋轉(zhuǎn)靈敏度。
static floatROTATION_SENSITIVITY_LOW指示 TimePicker 響應(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ù)描述
TimePicker(Context context)用于使用默認屬性集和樣式創(chuàng)建 TimePicker 實例的默認構(gòu)造函數(shù)。
TimePicker(Context context, AttrSet attrSet)用于在 XML 文件解析后使用指定的屬性集和默認樣式創(chuàng)建 TimePicker 實例的構(gòu)造函數(shù)。
TimePicker(Context context, AttrSet attrSet, String styleName)用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 TimePicker 實例的構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型方法描述
voidenableHour(boolean enable)設(shè)置是否啟用小時選擇器。
voidenableMinute(boolean enable)設(shè)置是否啟用分鐘選擇器。
voidenableSecond(boolean enable)設(shè)置是否啟用第二個選擇器。
TimePicker.AmPmOrdergetAmPmOrder()獲取表示上午的列的格式。
String[]getAmPmStrings()獲取表示上午的字符串數(shù)組。
StringgetAmString()獲取代表 a.m 的字符串。
ElementgetDisplayedBottomElement()獲取用于在時間選擇器中選定數(shù)字的底部繪制分割線的 Element 實例。
Element[]getDisplayedLinesElements()獲取用于在此時間選擇器中繪制分割線的實例數(shù)組。
ElementgetDisplayedTopElement()獲取此時間選擇器中頂部分割線的 Element 實例。
intgetHour()獲取選定的小時。
intgetMinute()獲取選定的分鐘。
ColorgetNormalTextColor()獲取時間選擇器中顯示的時間的正常字體顏色。
FontgetNormalTextFont()獲取此時間選擇器中普通文本的字體。
intgetNormalTextSize()獲取時間選擇器中顯示的時間的正常字體大小。
ElementgetOperatedTextBackgroundElement()獲取元素集作為正在操作的選中項的文本背景。
ColorgetOperatedTextColor()獲取時間選擇器中被操作文本的顏色。
StringgetPmString()獲取代表 p.m 的字符串。
voidgetRange(int[] ranges)獲取可選擇的時間范圍。
intgetSecond()獲得選定的秒數(shù)。
floatgetSelectedNormalTextMarginRatio()獲取此時間選擇器中選定文本與正常文本邊距的比率。
ElementgetSelectedTextBackgroundElement()獲取元素集作為在此時間選擇器中選擇的文本的背景。
ColorgetSelectedTextColor()獲取時間選擇器中顯示的時間的選定字體顏色。
FontgetSelectedTextFont()獲取此時間選擇器中選定文本的字體。
intgetSelectedTextSize()獲取時間選擇器中顯示的時間的選定字體大小。
intgetSelectorItemNum()獲取選擇器上顯示的項目數(shù)。
ColorgetShaderColor()獲取時間選擇器的著色器顏色。
TimePicker.TimeChangedListenergetTimeChangedListener()獲取用于監(jiān)聽該picker時間變化事件的回調(diào)對象。
booleanis24Hour()獲取時間是否以 24 小時制顯示。
booleanisHourEnabled()獲取是否啟用小時選擇器。
booleanisHourShown()獲取小時選擇器的狀態(tài)。
booleanisMinuteEnabled()獲取分鐘選擇器是否啟用。
booleanisMinuteShown()獲取分鐘選擇器的狀態(tài)。
booleanisSecondEnabled()獲取是否啟用了第二個選擇器。
booleanisSecondShown()獲取第二個選擇器的狀態(tài)。
booleanisWheelModeEnabled()獲取時間選擇器的選擇輪是否啟用輪模式。
voidset24Hour(boolean is24Hour)設(shè)置是否以 24 小時制顯示時間。
voidsetAmPmOrder(TimePicker.AmPmOrder order)設(shè)置表示上午的列的格式。
voidsetAmPmStrings(String am, String pm)設(shè)置代表上午的字符串。
voidsetAmString(String am)設(shè)置代表上午的字符串。
voidsetDisplayedBottomElement(Element bottom)將分割線設(shè)置在此時間選擇器中選定數(shù)字的底部。
voidsetDisplayedLinesElements(Element top, Element bottom)設(shè)置一個 Element 實例以在時間選擇器中為選定文本繪制分割線。
voidsetDisplayedTopElement(Element top)在此時間選擇器中設(shè)置所選數(shù)字頂部的分割線。
voidsetHour(int hour)設(shè)置選定的小時。
voidsetMinute(int minute)設(shè)置選定的分鐘。
voidsetNormalTextColor(Color color)設(shè)置時間選擇器中顯示的時間的正常字體顏色。
voidsetNormalTextFont(Font font)設(shè)置此時間選擇器中普通文本的字體。
voidsetNormalTextSize(int size)設(shè)置時間選擇器中顯示的時間的正常字體大小。
voidsetOperatedTextBackground(Element element)將指定的 Element 設(shè)置為正在操作的選中項的文本背景。
voidsetOperatedTextColor(Color color)設(shè)置時間選擇器中操作文本的顏色。
voidsetPmString(String pm)設(shè)置代表下午的字符串。
voidsetRange(int[] ranges)設(shè)置可選擇的時間范圍。
voidsetSecond(int second)設(shè)置選定的秒數(shù)。
voidsetSelectedNormalTextMarginRatio(float textMarginRatio)在此時間選擇器中設(shè)置所選文本邊距與正常文本邊距的比率。
voidsetSelectedTextBackground(Element element)將指定的 Element 設(shè)置為此時間選擇器中選定文本的背景。
voidsetSelectedTextColor(Color color)設(shè)置時間選擇器中顯示的時間的選定字體顏色。
voidsetSelectedTextFont(Font font)設(shè)置此時間選擇器中選定文本的字體。
voidsetSelectedTextSize(int size)設(shè)置時間選擇器中顯示的時間的選定字體大小。
voidsetSelectorItemNum(int itemNum)設(shè)置要在選擇器上顯示的項目數(shù)。
voidsetShaderColor(Color color)為時間選擇器設(shè)置著色器顏色。
voidsetTimeChangedListener(TimePicker.TimeChangedListener listener)設(shè)置偵聽器 TimePicker.TimeChangedListener 以偵聽所選時間的變化。
voidsetWheelModeEnabled(boolean isEnabled)設(shè)置是否為時間選擇器的選擇輪啟用輪模式。
voidshowHour(boolean show)設(shè)置是否顯示小時選擇器。
voidshowMinute(boolean show)設(shè)置是否顯示分鐘選擇器。
voidshowSecond(boolean show)設(shè)置是否顯示第二個選擇器。
從類 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, removeAllComponents, 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.StackLayout 繼承的方法
createLayoutConfig, verifyLayoutConfig

字段詳細信息

ROTATION_SENSITIVITY_DEFAULT

public static final float ROTATION_SENSITIVITY_DEFAULT

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

ROTATION_SENSITIVITY_HIGH

public static final float ROTATION_SENSITIVITY_HIGH

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

ROTATION_SENSITIVITY_LOW

public static final float ROTATION_SENSITIVITY_LOW

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

mTimeChangedListener

protected TimePicker.TimeChangedListener mTimeChangedListener

指示監(jiān)聽器 TimePicker.TimeChangedListener 監(jiān)聽所選時間的變化。

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

TimePicker

public TimePicker(Context context)

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

參數(shù):

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

TimePicker

public TimePicker(Context context, AttrSet attrSet)

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

參數(shù):

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

TimePicker

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

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

參數(shù):

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

方法詳情

isHourEnabled

public boolean isHourEnabled()

獲取是否啟用小時選擇器。

返回:

如果啟用了小時選擇器,則返回 true; 否則返回 false。

enableHour

public void enableHour(boolean enable)

設(shè)置是否啟用小時選擇器。

參數(shù):

參數(shù)名稱參數(shù)描述
enable指定是否啟用小時選擇器。 值 true 表示啟用小時選擇器,值 false 表示禁用小時選擇器。

showHour

public void showHour(boolean show)

設(shè)置是否顯示小時選擇器。

參數(shù):

參數(shù)名稱參數(shù)描述
show指定是否顯示小時選擇器。 值 true 表示顯示小時選擇器,值 false 表示隱藏小時選擇器。

isHourShown

public boolean isHourShown()

獲取小時選擇器的狀態(tài)。

返回:

如果顯示小時選擇器,則返回 true; 否則返回 false。

isMinuteEnabled

public boolean isMinuteEnabled()

獲取分鐘選擇器是否啟用。

返回:

如果啟用了分鐘選擇器,則返回 true; 否則返回 false。

enableMinute

public void enableMinute(boolean enable)

設(shè)置是否啟用分鐘選擇器。

參數(shù):

參數(shù)名稱參數(shù)描述
enable指定是否啟用分鐘選擇器。 值 true 表示啟用分鐘選擇器,值 false 表示禁用分鐘選擇器。

showMinute

public void showMinute(boolean show)

設(shè)置是否顯示分鐘選擇器。

參數(shù):

參數(shù)名稱參數(shù)描述
show指定是否顯示分鐘選擇器。 值 true 表示顯示分鐘選擇器,值 false 表示隱藏分鐘選擇器。

isMinuteShown

public boolean isMinuteShown()

獲取分鐘選擇器的狀態(tài)。

返回:

如果顯示分鐘選擇器,則返回 true; 否則返回 false。

isSecondEnabled

public boolean isSecondEnabled()

獲取是否啟用了第二個選擇器。

返回:

如果啟用了第二個選擇器,則返回 true; 否則返回 false。

enableSecond

public void enableSecond(boolean enable)

設(shè)置是否啟用第二個選擇器。

參數(shù):

參數(shù)名稱參數(shù)描述
enable指定是否啟用第二個選擇器。 值 true 表示啟用第二個選擇器,值 false 表示禁用第二個選擇器。

showSecond

public void showSecond(boolean show)

設(shè)置是否顯示第二個選擇器。

參數(shù):

參數(shù)名稱參數(shù)描述
show指定是否顯示第二個選擇器。 值 true 表示顯示第二個選擇器,值 false 表示隱藏第二個選擇器。

isSecondShown

public boolean isSecondShown()

獲取第二個選擇器的狀態(tài)。

返回:

如果顯示第二個選擇器,則返回 true; 否則返回 false。

getHour

public int getHour()

獲取選定的小時。

返回:

返回選定的小時。

setHour

public void setHour(int hour)

設(shè)置選定的小時。

參數(shù):

參數(shù)名稱參數(shù)描述
hour表示選定的小時。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果小時參數(shù)小于 0 或大于 23,則拋出此異常。

getMinute

public int getMinute()

獲取選定的分鐘。

返回:

返回選定的分鐘。

setMinute

public void setMinute(int minute)

設(shè)置選定的分鐘。

參數(shù):

參數(shù)名稱參數(shù)描述
minute表示選擇的分鐘。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果分鐘參數(shù)小于 0 或大于 59,則拋出此異常。

getSecond

public int getSecond()

獲得選定的秒數(shù)。

返回:

返回選定的秒數(shù)。

setSecond

public void setSecond(int second)

設(shè)置選定的秒數(shù)。

參數(shù):

參數(shù)名稱參數(shù)描述
second表示選擇的秒數(shù)。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果第二個參數(shù)小于 0 或大于 59,則拋出此異常。

set24Hour

public void set24Hour(boolean is24Hour)

設(shè)置是否以 24 小時制顯示時間。

參數(shù):

參數(shù)名稱參數(shù)描述
is24Hour指定時間是否以 24 小時模式顯示。 true表示時間以24小時制顯示,false表示時間不以24小時制顯示。

is24Hour

public boolean is24Hour()

獲取時間是否以 24 小時制顯示。

返回:

如果時間以 24 小時模式顯示,則返回 true; 否則返回 false。 默認值是true。

setTimeChangedListener

public void setTimeChangedListener(TimePicker.TimeChangedListener listener)

設(shè)置偵聽器 TimePicker.TimeChangedListener 以偵聽所選時間的變化。

參數(shù):

參數(shù)名稱參數(shù)描述
listener指示監(jiān)聽器監(jiān)聽所選時間的變化。

setRange

public void setRange(int[] ranges)

設(shè)置可選擇的時間范圍。 時間范圍按以下順序排列在數(shù)組中:開始小時、開始分鐘、開始秒、結(jié)束小時、結(jié)束分鐘和結(jié)束秒。

參數(shù):

參數(shù)名稱參數(shù)描述
ranges表示可以選擇的時間范圍。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果輸入?yún)?shù)無效,則拋出此異常:如果 range 為 null 或者 range.length 不等于 6 或者 range[0] "starting hour" 小于 0 或大于 23 或者 range[1] "starting 分鐘”小于 0 或大于 59 或范圍 [2] “開始秒”小于 0 或大于 59 或范圍 [3] “結(jié)束小時”小于 0 或大于 23 或范圍 [ 4] “結(jié)束分鐘”小于 0 或大于 59,或者如果范圍 [5] “結(jié)束秒”小于 0 或大于 59。

getRange

public void getRange(int[] ranges)

獲取可選擇的時間范圍。 時間范圍來自分配給輸入數(shù)組的值,并按以下順序返回:開始小時、開始分鐘、開始秒、結(jié)束小時、結(jié)束分鐘和結(jié)束秒。

參數(shù):

參數(shù)名稱參數(shù)描述
ranges表示可以選擇的時間范圍。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果輸入?yún)?shù)無效,則拋出此異常。

setNormalTextSize

public void setNormalTextSize(int size)

設(shè)置時間選擇器中顯示的時間的正常字體大小。

參數(shù):

參數(shù)名稱參數(shù)描述
size指示時間選擇器中顯示的時間的正常字體大小。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果輸入?yún)?shù)無效,則拋出此異常。

Since:

2

getNormalTextSize

public int getNormalTextSize()

獲取時間選擇器中顯示的時間的正常字體大小。

返回:

時間選擇器中顯示的時間的正常字體大小。

Since:

2

setSelectedTextSize

public void setSelectedTextSize(int size)

設(shè)置時間選擇器中顯示的時間的選定字體大小。

參數(shù):

參數(shù)名稱參數(shù)描述
size指示時間選擇器中顯示的時間的選定字體大小。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果輸入?yún)?shù)無效,則拋出此異常。

Since:

2

getSelectedTextSize

public int getSelectedTextSize()

獲取時間選擇器中顯示的時間的選定字體大小。

返回:

時間選擇器中顯示的時間的選定字體大小。

Since:

2

setNormalTextColor

public void setNormalTextColor(Color color)

設(shè)置時間選擇器中顯示的時間的正常字體顏色。

參數(shù):

參數(shù)名稱參數(shù)描述
color指示時間選擇器中顯示的時間的正常字體顏色。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果顏色參數(shù)為空,則引發(fā)此異常。

Since:

2

getNormalTextColor

public Color getNormalTextColor()

獲取時間選擇器中顯示的時間的正常字體顏色。

返回:

時間選擇器中顯示的時間的正常字體顏色。

Since:

2

setSelectedTextColor

public void setSelectedTextColor(Color color)

設(shè)置時間選擇器中顯示的時間的選定字體顏色。

參數(shù):

參數(shù)名稱參數(shù)描述
color指示時間選擇器中顯示的時間的選定字體顏色。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果顏色參數(shù)為空,則引發(fā)此異常。

Since:

2

getSelectedTextColor

public Color getSelectedTextColor()

獲取時間選擇器中顯示的時間的選定字體顏色。

返回:

時間選擇器中顯示的時間的選定字體顏色。

Since:

2

setOperatedTextColor

public void setOperatedTextColor(Color color)

設(shè)置時間選擇器中操作文本的顏色。

參數(shù):

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

Throws:

Throw名稱Throw描述
IllegalArgumentException如果顏色參數(shù)為空,則引發(fā)此異常。

Since:

3

getOperatedTextColor

public Color getOperatedTextColor()

獲取時間選擇器中被操作文本的顏色。

返回:

返回操作文本的顏色。

Since:

3

setNormalTextFont

public void setNormalTextFont(Font font)

設(shè)置此時間選擇器中普通文本的字體。

參數(shù):

參數(shù)名稱參數(shù)描述
font指示要設(shè)置的字體。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果字體參數(shù)為空,則引發(fā)此異常。

Since:

4

getNormalTextFont

public Font getNormalTextFont()

獲取此時間選擇器中普通文本的字體。

返回:

返回普通文本的字體。

Since:

4

setSelectedTextFont

public void setSelectedTextFont(Font font)

設(shè)置此時間選擇器中選定文本的字體。

參數(shù):

參數(shù)名稱參數(shù)描述
font指示要設(shè)置的字體。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果字體參數(shù)為空,則引發(fā)此異常。

Since:

4

getSelectedTextFont

public Font getSelectedTextFont()

獲取此時間選擇器中選定文本的字體。

返回:

返回所選文本的字體。

Since:

4

setSelectedTextBackground

public void setSelectedTextBackground(Element element)

將指定的 Element 設(shè)置為此時間選擇器中選定文本的背景。

參數(shù):

參數(shù)名稱參數(shù)描述
element指示要設(shè)置的元素。

Since:

4

getSelectedTextBackgroundElement

public Element getSelectedTextBackgroundElement()

獲取元素集作為在此時間選擇器中選擇的文本的背景。

返回:

返回元素。

Since:

4

setOperatedTextBackground

public void setOperatedTextBackground(Element element)

將指定的 Element 設(shè)置為正在操作的選中項的文本背景。

參數(shù):

參數(shù)名稱參數(shù)描述
element指示要設(shè)置的元素。

Since:

4

getOperatedTextBackgroundElement

public Element getOperatedTextBackgroundElement()

獲取元素集作為正在操作的選中項的文本背景。

返回:

返回元素。

Since:

4

setSelectedNormalTextMarginRatio

public void setSelectedNormalTextMarginRatio(float textMarginRatio)

在此時間選擇器中設(shè)置所選文本邊距與正常文本邊距的比率。

參數(shù):

參數(shù)名稱參數(shù)描述
textMarginRatio表示要設(shè)置的比率。 該值必須大于或等于 0.0f。 默認值為 1.0f。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果 textMarginRatio 參數(shù)小于 0,則拋出此異常。

Since:

3

getSelectedNormalTextMarginRatio

public float getSelectedNormalTextMarginRatio()

獲取此時間選擇器中選定文本與正常文本邊距的比率。

返回:

返回比率。

Since:

3

setDisplayedLinesElements

public void setDisplayedLinesElements(Element top, Element bottom)

設(shè)置一個 Element 實例以在時間選擇器中為選定文本繪制分割線。

參數(shù):

參數(shù)名稱參數(shù)描述
top指示要在所選文本頂部繪制分割線的 Element 實例。
bottom指示要在所選文本底部繪制分割線的 Element 實例。

Since:

4

getDisplayedTopElement

public Element getDisplayedTopElement()

獲取此時間選擇器中頂部分割線的 Element 實例。

返回:

返回元素實例。

Since:

4

getDisplayedBottomElement

public Element getDisplayedBottomElement()

獲取用于在時間選擇器中選定數(shù)字的底部繪制分割線的 Element 實例。

返回:

返回用于在所選數(shù)字底部繪制分割線的 Element 實例。

Since:

4

getDisplayedLinesElements

public Element[] getDisplayedLinesElements()

獲取用于在此時間選擇器中繪制分割線的實例數(shù)組。

返回:

返回用于繪制分割線的 Element 實例數(shù)組。

Since:

4

setDisplayedTopElement

public void setDisplayedTopElement(Element top)

在此時間選擇器中設(shè)置所選數(shù)字頂部的分割線。

參數(shù):

參數(shù)名稱參數(shù)描述
top指示要設(shè)置的頂部分割線。

Since:

4

setDisplayedBottomElement

public void setDisplayedBottomElement(Element bottom)

將分割線設(shè)置在此時間選擇器中選定數(shù)字的底部。

參數(shù):

參數(shù)名稱參數(shù)描述
bottom指示要設(shè)置的底部分割線。

Since:

4

setAmPmStrings

public void setAmPmStrings(String am, String pm)

設(shè)置代表 a.m. 和 p.m. 的字符串。

參數(shù):

參數(shù)名稱參數(shù)描述
am表示代表 a.m. 的字符串。
pm表示代表 p.m. 的字符串。

Since:

2

setAmString

public void setAmString(String am)

設(shè)置代表上午的字符串。

參數(shù):

參數(shù)名稱參數(shù)描述
am表示代表 a.m 的字符串。

Since:

4

setPmString

public void setPmString(String pm)

設(shè)置代表下午的字符串。

參數(shù):

參數(shù)名稱參數(shù)描述
pm表示代表 p.m 的字符串。

Since:

4

getAmPmStrings

public String[] getAmPmStrings()

獲取表示上午和下午的字符串數(shù)組。

返回:

返回指示 a.m. 和 p.m. 的字符串數(shù)組。

Since:

2

getAmString

public String getAmString()

獲取代表 a.m 的字符串。

返回:

返回代表 a.m 的字符串。

Since:

4

getPmString

public String getPmString()

獲取代表 p.m 的字符串。

返回:

返回代表 p.m 的字符串。

Since:

4

getTimeChangedListener

public TimePicker.TimeChangedListener getTimeChangedListener()

獲取用于監(jiān)聽該picker時間變化事件的回調(diào)對象。

返回:

返回回調(diào)對象。

Since:

4

setWheelModeEnabled

public void setWheelModeEnabled(boolean isEnabled)

設(shè)置是否為時間選擇器的選擇輪啟用輪模式。 如果啟用,則最大值環(huán)繞最小值。

參數(shù):

參數(shù)名稱參數(shù)描述
isEnabled指示是否啟用滾輪模式。 true 表示啟用滾輪模式; false 表示其他情況。

Since:

4

isWheelModeEnabled

public boolean isWheelModeEnabled()

獲取時間選擇器的選擇輪是否啟用輪模式。

返回:

如果啟用了滾輪模式,則返回 true; 否則返回 false。

Since:

4

setShaderColor

public void setShaderColor(Color color)

為時間選擇器設(shè)置著色器顏色。

參數(shù):

參數(shù)名稱參數(shù)描述
color指示著色器顏色。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果顏色參數(shù)為空,則引發(fā)此異常。

Since:

3

getShaderColor

public Color getShaderColor()

獲取時間選擇器的著色器顏色。

返回:

返回時間選擇器的著色器顏色。

Since:

3

setSelectorItemNum

public void setSelectorItemNum(int itemNum)

設(shè)置要在選擇器上顯示的項目數(shù)。

參數(shù):

參數(shù)名稱參數(shù)描述
itemNum指示要在選擇器上顯示的項目數(shù)。 該值必須大于 0。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果要在選擇器上顯示的項目數(shù)小于或等于 0,則引發(fā)此異常。

Since:

4

getSelectorItemNum

public int getSelectorItemNum()

獲取選擇器上顯示的項目數(shù)。

返回:

返回選擇器上顯示的項目數(shù); 如果未指定數(shù)字,則返回默認值 0。

Since:

4

setAmPmOrder

public void setAmPmOrder(TimePicker.AmPmOrder order)

設(shè)置表示上午和下午的列的格式。 在時間選擇器中。

代表上午和下午的列 通過指定值 AmPmOrder#START 或 AmPmOrder#END,可以在選取器的開頭或結(jié)尾顯示。 AmPmOrder#START 和 AmPmOrder#END 的方向(從左到右或從右到左)取決于指定的 Component.isRtl() 值。 通過指定 AmPmOrder#LEFT 或 AmPmOrder#RIGHT,該列也可以顯示在時間選擇器的左側(cè)或右側(cè)。

參數(shù):

參數(shù)名稱參數(shù)描述
order表示AmPmOrder枚舉值,可以是AmPmOrder#START、AmPmOrder#END、AmPmOrder#LEFT或AmPmOrder#RIGHT。

Throws:

Throw名稱Throw描述
IllegalArgumentException如果 order 參數(shù)為 null,則引發(fā)此異常。

Since:

3

getAmPmOrder

public TimePicker.AmPmOrder getAmPmOrder()

獲取時間選擇器中表示上午和下午的列的格式。

代表上午和下午的列 可以通過指定值 AmPmOrder#START 或 AmPmOrder#END 顯示在選取器的開頭或結(jié)尾。AmPmOrder#START 和 AmPmOrder#END 的方向(從左到右或從右到左)取決于 指定的 Component.isRtl() 值。

返回:

返回 AmPmOrder 枚舉值,可以是 AmPmOrder#START、AmPmOrder#END、AmPmOrder#LEFT 或 AmPmOrder#RIGHT。

Since:

3


網(wǎng)站標題:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OS TimePicker
瀏覽地址:http://www.5511xx.com/article/cdiooih.html