Added in API level 1

DatePicker


open class DatePicker : FrameLayout
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.FrameLayout
   ↳ android.widget.DatePicker

Provides a widget for selecting a date.

When the android.R.styleable#DatePicker_datePickerMode attribute is set to spinner, the date can be selected using year, month, and day spinners or a CalendarView. 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.

When the android.R.styleable#DatePicker_datePickerMode attribute is set to calendar, the month and day can be selected using a calendar-style view while the year can be selected separately using a list.

See the Pickers guide.

For a dialog using this view, see android.app.DatePickerDialog.

Summary

Nested classes
abstract

The callback used to indicate the user changed the date.

XML attributes
android:calendarTextColor The text color list of the calendar.
android:calendarViewShown Whether the calendar view is shown.
android:datePickerMode Defines the look of the widget.
android:dayOfWeekBackground The background color for the header's day of week.
android:dayOfWeekTextAppearance The text color for the header's day of week.
android:endYear The last year (inclusive), for example "2010".
android:headerBackground The background for the selected date header.
android:headerDayOfMonthTextAppearance The text appearance for the day of month (ex. 28) in the selected date header.
android:headerMonthTextAppearance The text appearance for the month (ex. May) in the selected date header.
android:headerYearTextAppearance The text appearance for the year (ex. 2014) in the selected date header.
android:maxDate The maximal date shown by this calendar view in mm/dd/yyyy format.
android:minDate The minimal date shown by this calendar view in mm/dd/yyyy format.
android:spinnersShown Whether the spinners are shown.
android:startYear The first year (inclusive), for example "1940".
android:yearListItemTextAppearance The list year's text appearance in the list.
android:yearListSelectorColor The list year's selected circle color in the list.
Inherited XML attributes
Inherited constants
Public constructors
DatePicker(context: Context!)

DatePicker(context: Context!, attrs: AttributeSet!)

DatePicker(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

DatePicker(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Unit

Automatically fills the content of this view with the value.

open Unit

Dispatches creation of a ViewStructures for autofill purposes down the hierarchy, when an Assist structure is being created as part of an autofill request.

open CharSequence!

Return the class name of this object to be used for accessibility purposes.

open Int

Describes the autofill type of this view, so an android.service.autofill.AutofillService can create the proper AutofillValue when autofilling the view.

open AutofillValue?

Gets the View's current autofill value.

open CalendarView!

Returns the CalendarView used by this picker.

open Boolean

Returns whether the CalendarView is shown.

open Int

open Int

Gets the first day of week.

open Long

Gets the maximal date supported by this DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

open Long

Gets the minimal date supported by this DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

open Int

open Boolean

Returns whether the spinners are shown.

open Int

open Unit
init(year: Int, monthOfYear: Int, dayOfMonth: Int, onDateChangedListener: DatePicker.OnDateChangedListener!)

Initialize the state.

open Boolean

Returns the enabled status for this view.

open Unit

Sets whether the CalendarView is shown.

open Unit
setEnabled(enabled: Boolean)

Set the enabled state of this view.

open Unit
setFirstDayOfWeek(firstDayOfWeek: Int)

Sets the first day of week.

open Unit
setMaxDate(maxDate: Long)

Sets the maximal date supported by this DatePicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

open Unit
setMinDate(minDate: Long)

Sets the minimal date supported by this NumberPicker in milliseconds since January 1, 1970 00:00:00 in TimeZone.getDefault() time zone.

open Unit

Set the callback that indicates the date has been adjusted by the user.

open Unit

Sets whether the spinners are shown.

open Unit
updateDate(year: Int, month: Int, dayOfMonth: Int)

Update the current date.

Protected methods
open Unit

Called by restoreHierarchyState(android.util.SparseArray) to retrieve the state for this view and its children.

open Unit

Called when the current configuration of the resources being used by the application have changed.

open Unit

Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState.

open Parcelable?

Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.

Inherited functions