Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.


public class TimePicker
extends Picker

   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ androidx.leanback.widget.picker.Picker
           ↳ androidx.leanback.widget.picker.TimePicker

TimePicker is a direct subclass of Picker.

This class is a widget for selecting time and displays it according to the formatting for the current system locale. The time can be selected by hour, minute, and AM/PM picker columns. The AM/PM mode is determined by either explicitly setting the current mode through setIs24Hour(boolean) or the widget attribute is24HourFormat (true for 24-hour mode, false for 12-hour mode). Otherwise, TimePicker retrieves the mode based on the current context. In 24-hour mode, TimePicker displays only the hour and minute columns.

This widget can show the current time as the initial value if useCurrentTime is set to true. Each individual time picker field can be set at any time by calling setHour(int), setMinute(int) using 24-hour time format. The time format can also be changed at any time by calling setIs24Hour(boolean), and the AM/PM picker column will be activated or deactivated accordingly. R.attr.is24HourFormat R.attr.useCurrentTime


Inherited constants

Inherited fields

Public constructors

TimePicker(Context context, AttributeSet attrs)

Constructor called when inflating a TimePicker widget.

TimePicker(Context context, AttributeSet attrs, int defStyleAttr)

Constructor called when inflating a TimePicker widget.

Public methods

int getHour()

Returns the currently selected hour using 24-hour time.

int getMinute()

Returns the currently selected minute.

boolean is24Hour()
boolean isPm()

Only meaningful for a 12-hour time.

void onColumnValueChanged(int columnIndex, int newValue)

Classes extending Picker can override this function to supply the behavior when a list has been scrolled.

void setHour(int hour)

Sets the currently selected hour using a 24-hour time.

void setIs24Hour(boolean is24Hour)

Sets whether this widget displays a 24-hour mode or a 12-hour mode with an AM/PM picker.

void setMinute(int minute)

Sets the currently selected minute.

Inherited methods