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
TimePicker使用详解
本文介绍了一个用于选择一天中时间的视图组件TimePicker,包括其基本功能和使用方法。通过示例展示了如何设置时间和监听时间变化,适用于24小时制或AM/PM模式。

被折叠的 条评论
为什么被折叠?



