【Android】时间与日期Widget(DatePicker 与 TimePicker)
public class
DatePicker
extends FrameLayoutjava.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.FrameLayout | |||
↳ | android.widget.DatePicker |
Class Overview
This class is a widget for selecting a date. The date can be selected by a year, month, and day spinners or aCalendarView
. The set of spinners and the calendar view are automatically synchronized. The client can customize whether only the spinners, or only the calendar view, or both to be displayed. Also the minimal and maximal date from which dates to be selected can be customized.
See theDate Picker tutorial.
To provide a widget for selecting a date, use theDatePicker
widget, which allows the user to select the month, day, and year, in a familiar interface.
In this tutorial, you'll create aDatePickerDialog
, which presents the date picker in a floating dialog box at the press of a button. When the date is set by the user, aTextView
will update with the new date.
public class
TimePicker
extends FrameLayoutjava.lang.Object | ||||
↳ | android.view.View | |||
↳ | android.view.ViewGroup | |||
↳ | android.widget.FrameLayout | |||
↳ | android.widget.TimePicker |
Class Overview
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, seeTimePickerDialog
.
See theTime Picker tutorial.
更多相关文章
- android TextView 丰富多彩的字体样式代码
- numberPicker实现时间选择设置功能
- Android设置输入框和软键盘动态悬浮
- Android与HTML5交互模版
- 安卓加载网页
- popuwindow
- android 在WebView打开网页
- Android(安卓)Tint ImageView 无法设置Tintlist问题
- Android(安卓)RatingBar