我希望我的 DatePickerDialog 一打开就显示年份列表。
For example, when I show the dialog I see the calendar view:
:
If I tap on the text "1900" the year view is shown:
我尝试了这段代码,但它没有效果,我对我能做什么一无所知:DatePickerDialog birthDatePicker = new DatePickerDialog(getActivity(), this, 0, 0, 0);
birthDatePicker.getDatePicker().setSpinnersShown(true);
birthDatePicker.show();
Same as 在 Android 日历视图中首先显示年份选择 https://stackoverflow.com/questions/38477118/show-year-selection-first-in-android-calendar-view/46223200#46223200
我将我的答案复制在这里:
您可以获得对年视图的引用,然后只需模拟用户单击即可打开它。
dataPicker.getTouchables().get( 0 ).performClick();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)