Android Calendar View for Date Picker

后端 未结 8 950
粉色の甜心
粉色の甜心 2020-12-02 09:24

I\'m writing my first app, and I have a question about DatePicker.

My app requires the user to input a date. The most user-friendly way would be to popu

8条回答
  •  有刺的猬
    2020-12-02 10:11

    Now, in 2014, even the native DatePicker (link) contains small Holo looking CalendarView (link) to pick a day in month.

    You can choose, if both spinners and CalendarView or just one of them is displayed by setting:

    • android:calendarViewShown
    • android:spinnersShown

    I'm not sure if it's just API level 16+ or if it was even in Ice Cream Sandwich, but it's there. This is how it looks by default:

    enter image description here


    Moreover, on API level 21 and higher there is a new Material themed DatePicker that looks like following:

    enter image description here

    This is default on API 21+ and there are no spinners anymore, but you can switch back to the Holo one by setting

    android:datePickerMode="spinner"
    

    in your XML.

提交回复
热议问题