TimePicker:
A view for selecting the time of day, in either 24 hour or AM/PM mode. The hour, each minute digit, and AM/PM (if applicable) can be conrolled by vertical spinners. The hour can be entered by keyboard input. Entering in two digit hours can be accomplished by hitting two digits within a timeout of about a second (e.g. '1' then '2' to select 12). The minutes can be entered by entering single digits. Under AM/PM mode, the user can hit 'a', 'A", 'p' or 'P' to pick. For a dialog using this view, see TimePickerDialog
.
即,时间设定的view。可以手段输入时间,也可以通过点击“+”或“—”来设置时间。
重要方法:
TimePicker.onTimeChangedListener:TimePicker的内部类,用来监听时间发生变化时的方法。
setCurrentHour():设置小时
setCurrentMinute(): 设置分钟
getCurrentHour(): 获取当前的小时
getCurrentMinute(): 获取当前的分钟
示例:
date_widgets_example_2.xml
DateWidget2.java