DatePickerDialog display year picker first

前端 未结 2 990
执念已碎
执念已碎 2021-02-07 19:19

I want my DatePickerDialog as soon as it opens to display the list of years.

For example, when I show the dialog I see the calendar view:

相关标签:
2条回答
  • 2021-02-07 20:02

    Same as Show year selection first in Android Calendar View

    I will copy here my answer:

    You can get a reference to year view and then just simulate user click to open it.

    dataPicker.getTouchables().get( 0 ).performClick();
    
    0 讨论(0)
  • 2021-02-07 20:17

    Using the Datepicker XML modifications you can elect to show spinners instead of the Calendar, which might be beneficial for you as you want to directly edit the years.

    android:datePickerMode="spinner"
    
    0 讨论(0)
提交回复
热议问题